本文介绍了传递多个数组以在代码点火器中查看的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的模型是这两个函数视图和spl
my model is this,,, two functions view and spl
function view(){
$result = $this -> db -> get('tb_ourcity');
return $result->result_array();
//$query = $this->db->query('SELECT * from `adds`');
//return $query->result_array();
}
function spl(){
$result2 = $this -> db -> get('td_spei');
return $result2->result_array();
//$query = $this->db->query('SELECT * from `adds`');
//return $query->result_array();
}
我的控制器看起来像这样
my controller looks like ths
public function index()
{
$data['result']=$this->load_city->view();
$data2['result']=$this->load_city->spl();
$this->load->view('home_view',$data);
}
我有两个名为$ data和$ data2的数组。.
i have two arrays named $data and $data2..
我想在home_view中同时使用这两个数组。那么如何在单个视图中传递这两个数组
i want to use these two arrays simultaneously in the home_view. so how to pass these 2 arrays in single view
推荐答案
在模型中尝试一下
public function index()
{
$data['result1']=$this->load_city->view();
$data['result2']=$this->load_city->spl();
$this->load->view('home_view',$data);
}
您可以将这两个数组视为$ result1& $ result2
you can get these two array in view as $result1 & $result2
这篇关于传递多个数组以在代码点火器中查看的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!