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

[HELP] 为什么加载不到模型的方法

[复制链接]
发表于 2011-12-16 21:41:33 | 显示全部楼层 |阅读模式
出现的问题:
A PHP Error was encounteredSeverity: Notice
Message:  Undefined property:  Note:Note_model
Filename: controllers/note.php
Line Number: 19

Fatal error:  Call to a member function index() on a non-object in D:\www\dilicms\application\controllers\note.php on line 19

1.我的控制器是note.php
代码如下:<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
class Note extends CI_Controller{
function __construct()
{
  parent::__construct();
}
function index()
{
     $this->load->model('note_model');
     $data['item']=$this->Note_model->index();
     $this->load->view('noteview',$data);
}
function save(){
     
}
function xianshi(){
     
}

}
?>
2.模型note_model.php
代码如下:
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
class Note_model extends CI_Model {
    var $obj = '';
    var $zfcontent = '';
    var $author = '';
    function __construct(){
        parent::__construct();
    }
    function index(){   
        $query = $this->db->query('select * from dili_u_m_content');
        return $query->result();
    }
}
?>

发表于 2011-12-16 22:53:09 | 显示全部楼层
$this->load->model('note_model'); => $this->load->model('Note_model');

点评

已经解决,原来是没有自动加载数据库!  发表于 2011-12-17 10:07
我已经试过了,不行的,错误依旧!  发表于 2011-12-17 09:55

本版积分规则