简体   繁体   English

如何在Codeigniter HMVC中加载ion auth模型

[英]How to load ion auth model in codeigniter HMVC

I am using the ion auth library for the CodeIgniter HMVC, I have copied all files from ion auth library to main CodeIgniter files but the controller, model, and views files copy to module directory Now it's showing me this error. 我正在使用CodeIgniter HMVC的ion auth库,我已将所有文件从ion auth库复制到主CodeIgniter文件中,但控制器,模型和视图文件复制到了模块目录中,现在向我显示此错误。

A PHP Error was encountered 遇到PHP错误

Severity: Notice 严重程度:注意

Message: Undefined property: Auth::$ion_auth_model 消息:未定义的属性:Auth :: $ ion_auth_model

Filename: libraries/Ion_auth.php 文件名:libraries / Ion_auth.php

Line Number: 122 行号:122

Backtrace: 回溯:

File: /opt/lampp/htdocs/CI_Hmvc/application/libraries/Ion_auth.php Line: 122 Function: _error_handler 文件:/opt/lampp/htdocs/CI_Hmvc/application/libraries/Ion_auth.php行:122功能:_error_handler

File: /opt/lampp/htdocs/CI_Hmvc/application/libraries/Ion_auth.php Line: 70 Function: __get 文件:/opt/lampp/htdocs/CI_Hmvc/application/libraries/Ion_auth.php行:70功能:__get

File: /opt/lampp/htdocs/CI_Hmvc/application/third_party/MX/Loader.php Line: 173 Function: _ci_load_library 文件:/opt/lampp/htdocs/CI_Hmvc/application/third_party/MX/Loader.php行:173功能:_ci_load_library

File: /opt/lampp/htdocs/CI_Hmvc/application/third_party/MX/Loader.php Line: 192 Function: library 文件:/opt/lampp/htdocs/CI_Hmvc/application/third_party/MX/Loader.php行:192功能:库

File: /opt/lampp/htdocs/CI_Hmvc/application/third_party/MX/Loader.php Line: 153 Function: libraries 文件:/opt/lampp/htdocs/CI_Hmvc/application/third_party/MX/Loader.php行:153功能:库

File: /opt/lampp/htdocs/CI_Hmvc/application/modules/home/controllers/Auth.php Line: 9 Function: library 文件:/opt/lampp/htdocs/CI_Hmvc/application/modules/home/controllers/Auth.php行:9功能:库

File: /opt/lampp/htdocs/CI_Hmvc/index.php Line: 315 Function: require_once 文件:/opt/lampp/htdocs/CI_Hmvc/index.php行:315功能:require_once

could anybody tell me how to load the model, when I work as modules? 当我作为模块工作时,有人可以告诉我如何加载模型吗?

I believe the problem is that the library is not finding the model. 我相信问题在于图书馆找不到模型。 Check inside ion auth library construct. 检查内部ion auth库的构造。 Look for the line where it says 寻找它说的那一行

   $this->load->model('ion_auth_model'). 

It should be line 122 since that's where the error is ocurring. 应该是第122行,因为这是发生错误的地方。 In here you need to prefix the module name - where you have the ion_auth_model - to the model path so the loader class knows where to find it. 在这里,您需要在模块路径之前加上模块名称(在其中具有ion_auth_model ),以便加载程序类知道在哪里可以找到它。

In your case if the module's name is directory, then 'directory/ion_auth_model'. 在您的情况下,如果模块的名称为directory,则为“ directory / ion_auth_model”。

Check this solution https://stackoverflow.com/a/7003180/5785088 , point 10, last item. 检查此解决方案https://stackoverflow.com/a/7003180/5785088 ,第10点,最后一项。 Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM