2014-04-14 24 views
0

我打开我的模型是这样要装载的型号名称是已经被使用的资源的名称:

class Admin_user extends CI_Controller { 

    function __construct() 
    { 
     parent::__construct(); 

     CheckLoginIn(); 

     $this->load->model('admin_user_model','model'); 
    } 

     function index(){ 
      //my function.. 
     } 
    } 

模型最初每一件事情是好的... 然后我不得不用钩..

我hooks.php文件

$hook['pre_controller'] = array(
    'class' => 'MyClass', 
    'function' => 'get_code', 
    'filename' => 'Myclass.php', 
    'filepath' => 'hooks' 
); 

现在我得到这个错误。

The model name you are loading is the name of a resource that is already being used: model 

但是如果我设置$config['enable_hooks'] = FALSE;一切正常......

回答

0

得到的答案..我不得不用户post_controller_constructor而不是pre_controller所以我的钩子文件将

$hook['post_controller_constructor'] = array(
    'class' => 'MyClass', 
    'function' => 'get_code', 
    'filename' => 'Myclass.php', 
    'filepath' => 'hooks' 
); 
相关问题