致命错误:在第19行的C:\ xampp \ htdocs \ tulip \ application \ controllers \ slider.php中的非对象上调用成员函数insert_slider()
这是我的控制器:
类Slider扩展了CI_Controller {
public function __construct(){
parent::__construct();
$this->load->library('upload');
$this->load->database();
$this->load->helper(array('form', 'url'));
//$this->load->library('session');
}
public function add_slider(){
$data = array('slider_name' => $this->input->post('title'),'desc'=>$this->input->post('desc'));
$slider_id= $this->slider_model->insert_slider($data);
@$data=$this->do_upload($slider_id,'image1');
$this->resizer('../sliders/'.$data['file_name'],192,300,'thumb1');
//$this->resizer('../sliders/'.$data['file_name'],60,300,'thumb2');
//$this->view_movie($movie_id);
$this->view_slider($slider_id);
}//end else
}
我的模特是:
public function __construct(){
parent::__construct();
}
public function insert_slider($data){
$this->load->database();
$this->db->insert('slider', $data);
$id= $this->db->insert_id();
$this->db->where('slider_id',$id);
$this->db->update('slider',array('position'=>$id));
return $id;
}
}
错误是什么,我还是找不到它?
答案 0 :(得分:2)
我认为您错过了模型尝试加载构造函数或add_slider函数
$this->load->model('slider_model');