【发布时间】:2011-11-06 13:24:03
【问题描述】:
我无法正确设置具有 hmvc 和 tank auth(设置为模块)的工作 Codeigniter 版本 2.0.3。我已经正确安装了 CI,然后按照这些说明安装 HMVC https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/wiki/Home
我以我的欢迎控制器/视图为例就好了,这意味着 HMVC 正在工作。接下来,我尝试通过将 tank auth 添加到模块文件夹中的文件夹来将其添加到项目中。它具有适当的控制器/视图/模型等。在坦克身份验证中设置。我什至在路线中添加了类似
$route["auth"]="auth/login";
我还按照指示将 auth 模块中的控制器扩展为 MX_Controller。我也在构造函数中:
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->load->library('security'); <--failing to load this
$this->load->library('tank_auth');
$this->lang->load('tank_auth');
$this->form_validation->CI =& $this;
它似乎可以很好地重定向到模块但是它出现了一个错误说::
遇到错误
无法加载请求的类:安全性
我做错了什么?是否有人将 HMVC 和 tank auth 作为模块进行了有效的 CI 安装,所以我可以看到它是如何完成的?我是 HMVC 新手,谢谢
【问题讨论】:
-
库文件夹中是否存在security.php文件?
-
security.php 是 codeigniter 本身的一部分,因此它不位于 modules/auth/libraries/... 文件夹中。我是否必须获取 CI 的实例才能在模块控制器的构造函数中调用其库/助手?
-
所以我改了 $this->load->library('security');到 $this->load->helper('security');现在出现了一个新错误,我想当它尝试加载tank_auth库时,说找不到配置文件tank_auth.php..虽然有modules/modulename/config/tank_auth.php完好无损。不知道为什么它会找到它,但我假设它类似于我的其他问题
-
CodeIgniter 中有不同种类的安全文件,其中一种是帮助程序,另一种用于在提交到数据库时对数据进行转义。
-
原来的 tank auth 需要库 security 而不是 helper,tank auth 只使用 CI 的原生安全库,不提供自己的
标签: codeigniter hmvc tankauth