Codeigniter 会话库 - HMVC
Codeigniter Session Library - HMVC
我 运行 遇到了问题,同时在 CI 3.0.3 和最新的 HMVC Extension 中编码。我正在自动加载一些库、助手等等。会话库也是如此。现在我有几个控制器都工作正常,除了一个。
在那个控制器中我使用了这个代码:
modules::run($module->module . '/' . $module->controller . '/' . $module->method, unserialize($block->configuration));
使用这个静态函数时出现错误:
Unable to locate the specified class: Session.php
日志显示会话 class 已初始化。
INFO - 2015-12-01 09:41:40 --> Session: Class initialized using 'database' driver.
知道为什么会出现此错误吗?
编辑:---------------------------------------- --------------------------
为了防止如下愚蠢的答案...
In CI we can’t call more than 1 controller per request. Therefore, to achieve HMVC, we have to simulate controllers. It can be done with libraries, or with this “Modular Extensions HMVC” contribution.
The differences between using a library and a “Modular HMVC” HMVC class is: 1. No need to get and use the CI instance within an HMVC class 2. HMVC classes are stored in a modules directory as opposed to the libraries directory.
编辑 2:---------------------------------------- --------------------------
更多问题:
- 是的,问题出在会话库
- 是,仅与此 HMVC 插件结合使用
- 是的,仅当您使用静态方法时
modules::run();
- 不,我需要这个方法来模拟控制器中的控制器
简单。
如果要在控制器中加载控制器,请使用:
Modules::load();
或将 Modules::run();
外包到由主控制器加载的视图中。
简单。
我 运行 遇到了问题,同时在 CI 3.0.3 和最新的 HMVC Extension 中编码。我正在自动加载一些库、助手等等。会话库也是如此。现在我有几个控制器都工作正常,除了一个。
在那个控制器中我使用了这个代码:
modules::run($module->module . '/' . $module->controller . '/' . $module->method, unserialize($block->configuration));
使用这个静态函数时出现错误:
Unable to locate the specified class: Session.php
日志显示会话 class 已初始化。
INFO - 2015-12-01 09:41:40 --> Session: Class initialized using 'database' driver.
知道为什么会出现此错误吗?
编辑:---------------------------------------- --------------------------
为了防止如下愚蠢的答案...
In CI we can’t call more than 1 controller per request. Therefore, to achieve HMVC, we have to simulate controllers. It can be done with libraries, or with this “Modular Extensions HMVC” contribution.
The differences between using a library and a “Modular HMVC” HMVC class is: 1. No need to get and use the CI instance within an HMVC class 2. HMVC classes are stored in a modules directory as opposed to the libraries directory.
编辑 2:---------------------------------------- --------------------------
更多问题:
- 是的,问题出在会话库
- 是,仅与此 HMVC 插件结合使用
- 是的,仅当您使用静态方法时
modules::run();
- 不,我需要这个方法来模拟控制器中的控制器
简单。
如果要在控制器中加载控制器,请使用:
Modules::load();
或将 Modules::run();
外包到由主控制器加载的视图中。
简单。