これは私のコントローラークラスです
public function _construct()
{
parent::_construct();
$this->load->model('customer_model');
}
public function create()
{
$this->load->helper('form');
$this->load->library('form_validation');
$this->form_validation->set_rules('name', 'Title', 'required');
$this->form_validation->set_rules('address', 'text', 'required');
if ($this->form_validation->run() === FALSE)
{
$this->load->helper('url');
$this->load->view('templates/header');
$this->load->view('master/customer');
}
else
{
$this->customer_model->register();
//$this->load->view('news/success');
}
} }
これが私のムーデルクラスです
class Customer_model extends CI_model {
public function _construct()
{
$this->load->database();
}
public function register()
{
$data = array(
'name' => $this->input->post('name'),
'address' => $this->input->post('address')
);
return $this->db->insert('registration', $data);
}
}
codeigniter の実行中にこのエラーが発生します
PHP エラーが発生しました
重大度: 通知
メッセージ: 未定義のプロパティ: Customer::$customer_model
ファイル名: controllers/customer.php
ライン番号: 30
致命的なエラー: 30 行目の C:\xampp\htdocs\CodeIgniter_2.1.3\application\controllers\customer.php の非オブジェクトに対するメンバー関数 register() の呼び出し
私は体をコードイグナイターするのが初めてですこのエラーが発生する理由を教えてください