是否可以将关联数组从模型传递到 Controller 并在 Controller 中使用它?
最佳答案
模型函数的简单返回结果,例如:-
public function my() {
// your code
return $query->result_array(); // may be your any result
}
并在 Controller 中调用此函数:-
加载模型:-
$this->load->model('your_model');
获取数据:-
$result = $this->your_model->my();
您将在 Controller 的$result
中获得数组
关于php - CodeIgniter:将数据从模型传递到 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23926464/