|
controller有一个array,我希望在model中也可以访问到
Controller:
$data = array(
'username' => $this->input->post('username'),
'password' => $this->input->post('password')
);
$this->load->model('User_model'); //载入模型
$this->User_model->addUser($data); //执行模型中的方法
Model:
$this->username = $data['username'];
$this->password = $data['password'];
$this->db->insert('user', $this);
问题是貌似model中$data['username']这种是访问不了的? |
|