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

[讨论/交流] 控制器加载不了模型

[复制链接]
发表于 2013-8-17 07:52:37 | 显示全部楼层 |阅读模式
我写控制器为什么加载不了模型呢!!求各位大虾帮忙啊
控制器message.php
class Message extends CI_Controller{
        public function __construct(){
                parent::__construct();
        }
        public function index(){
                $this -> load ->view('index');
        }
        public function edit(){
                $arr = $_POST;
                $this -> load ->model('insertmsg');
                $query = $this ->insertmsg->insert_msg($arr);
                print_r($query);
        }
}
模型:insertmsg.php
class Insertmsg extends CI_Model(){
        public function __construct(){
                parent::__construct();
                this -> load ->database();
        }
        public function insert_msg($arr){
                $this ->db ->insert('msg',$arr);
        }
}
数据库名为msgbox;表名为:msg; 在视图中的数据能打印出来,但就是加载不了模型{:soso_e109:}
发表于 2013-8-27 11:52:38 | 显示全部楼层
$this -> load ->model('insertmsg');
发表于 2013-8-27 11:52:54 | 显示全部楼层
改成 $this -> load ->model('Insertmsg');
发表于 2013-8-27 17:45:13 | 显示全部楼层
模型:insertmsg.php
class Insertmsg extends CI_Model(){
        public function __construct(){
                parent::__construct();
                this -> load ->database();
                $this -> load ->database();
        }
        public function insert_msg($arr){
                $this ->db ->insert('msg',$arr);
        }
}

本版积分规则