Codeigniter从不同的文件夹模型加载数据

时间:2017-06-01 04:48:11

标签: codeigniter

$this->load->model('product/Product_model');
$product_data['p_data'] = $this->Product_model->fetch_data();
$this->load->model('catagory/Catagory_model');
$cdata['catagory_data'] =  $this->Catagory_model->getAllcategory();

我想在$ alldata ['all']

中发送 $ product_data ['p_data'] $ cdata ['catagory_data']
$this->load->view('product/index',$alldata);

1 个答案:

答案 0 :(得分:0)

分配alldata如下所示:

<?php
$this->load->model('product/Product_model');
$this->load->model('catagory/Catagory_model');
$alldata['p_data'] = $this->Product_model->fetch_data();
$alldata['catagory_data'] =  $this->Catagory_model->getAllcategory();;
$this->load->view('product/index',$alldata);
?>

index视图中提取alldata。