【发布时间】:2016-09-06 07:25:08
【问题描述】:
请任何机构提供帮助。
在codeigniter中使用方法(函数)的正确过程。
我的意思是为模型中的每个任务编写单独的方法或使用一种用于通用目的的方法。 即
1:-一种方法
public function insert_records($tabel, $data){
return $this->db->insert($tabel, $data);
}
2:-第二种方法
public function insert_user(){
return $this->db->insert('users', array('name'=>$this->input->post('name'),'email'=>$this->input->post('email'));
}
老师也一样
public function insert_teacher(){
return $this->db->insert('teachers', array('name'=>$this->input->post('name'),'email'=>$this->input->post('email'));
}
请给出正确的解决方案,最好是使用单独的函数,还是最好在一个函数中传递数据和表名。? 如果有人没有正确的解决方案,请让专家给出正确的解决方案。
【问题讨论】:
标签: php mysql model-view-controller