用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2139|回复: 5
收起左侧

[HELP] 为什么我不能load model 呢?急啊啊啊啊~

[复制链接]
发表于 2013-5-4 17:39:33 | 显示全部楼层 |阅读模式
报错信息 :
controller 代码 $this->load->model('power'); $this->load->model('Power'); 都试过的。。  


  controller文件位置
   model 文件位置  
   model 代码
 楼主| 发表于 2013-5-5 09:49:15 | 显示全部楼层
大神啊~~ 求指教啊啊啊啊
 楼主| 发表于 2013-5-5 10:14:33 | 显示全部楼层
啊啊啊啊啊我终于找到原因了。!!!

PHP复制代码
class Admin extends CI_Controller {
 
        public function __construct() {
                parent::__construct();
                //$this->load->library('AUser');
        }
 
        public function index()
        {
                $this->load->model('Heng_m');
               
               
                $this->auser->isLogin();
                echo '123';
                exit;
        }
复制代码
 楼主| 发表于 2013-5-5 10:19:38 | 显示全部楼层
重点是在控制器构造方法里面, $this->load-library('AUser')。。。注释掉就没事了,可是,之前没有 load mode 的时候这样子做没有什么问题啊 ~~~ 继续找。我把这一句放在具体控制器类中,先放在load->model之前,还是那样的错误,$Heng_m未定义
PHP复制代码
         */
        public function index()
        {
               
                $this->load->library('AUser');         
               
                $this->load->model('Heng_m');
               
                $this->Heng_m->adduser();
                echo '123';
                exit;
        }
复制代码
 楼主| 发表于 2013-5-5 10:23:35 | 显示全部楼层
然后把 $this->load-library('AUser');放在$ths->load->model('Heng_m'); 之后就一切正常了,mode能够正常使用,自定义的auser类也可以正常使用了
PHP复制代码
        public function index()
        {
               
                $this->load->library('AUser');         
               
                $this->load->model('Heng_m');
               
                $this->Heng_m->adduser();
               
                $this->auser->isLogin();
        }
复制代码




ps:  难道你们就没有遇到过这样的问题么。。 那岂不是只要需要用的 auser类的时候就需要手动导入呀
发表于 2013-5-6 13:05:09 | 显示全部楼层
到底是什么问题,你是装载哪个 model ?到底是 Power 还是 Heng_m 还是 AUser
我都看晕了。。。。

本版积分规则