我是新手用笨并努力学习污物在笨.. 我的网站控制器:codeigniter site_model严重性:通知错误此行有什么问题?
class Site extends CI_Controller
{
function index()
{
$data = array();
if($query = $this->site_model->get_records())
{
$data['records'] = $query;
}
$this->load->view('options_view', $data);
}
而且我site_model是:
class Site_model extends CI_Model {
function __construct(){
parent::__construct();
}
function get_records()
{
$query = $this->db->get('data');
return $query->result();
}
function add_record($data)
{
$this->db->insert('data', $data);
return;
}
function update_record($data)
{
$this->db->where('id', 12);
$this->db->update('data', $data);
}
function delete_row()
{
$this->db->where('id', $this->uri->segment(3));
$this->db->delete('data');
}
}
我做了$自动加载[“库” ] = array('database'); 当我尝试检查网站,我得到错误:
Severity: Notice
Message: Undefined property: Site::$site_model
Filename: controllers/site.php
Line Number: 9
什么是错的代码?
是的,它是在线9 – ytsejam 2012-07-30 21:13:09