mose 发表于 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:}

frankth 发表于 2013-8-27 11:52:38

$this -> load ->model('insertmsg');

frankth 发表于 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);
      }
}
页: [1]
查看完整版本: 控制器加载不了模型