[英]how to pass data array in redirect method using codeigniter
控制器-
public function add_to_cart($id,$quantity){
$this->load->model("getdb");
$this->load->model('shops_model');
$ins=TRUE;
$product1= $this->getdb->Product($id);
$price1 = $quantity/$product1[0]->min_quantity;
foreach ($this->cart->contents() as $items) {
if($items['id']==$id){
$ins=FALSE;
$data = array(
'rowid' => $items['rowid'],
'id' => $id,
'price' => $product1[0]->selling_price*$price1,
'name' => $product1[0]->product_name,
'options' => array('image' =>$product1[0]->image1, 'unit' => $product1[0]->unit, 'quantity' => $quantity)
);
$this->cart->update($data);
}
}if($ins){
$data = array(
'id' => $id,
'qty' => 1,enter code here
'price' => $product1[0]->selling_price*$price1,
'name' => $product1[0]->product_name,
'options' => array('image' =>$product1[0]->image1, 'unit' => $product1[0]->unit, 'quantity' => $quantity)
);
$this->cart->insert($data);
}
$data['shops_id_data']= $this->shops_model->getshopiddata($id);
$a = end(end($data['shops_id_data']));
$data['shops_data']= $this->shops_model->getshopdata($a);
redirect('Shops/shop_page');
}
在这里,我想重定向在shop_page方法上,并且我也想使用重定向方法在shop_page上传递$ data ['shop_data]数组,而不使用$ this->> load-> view('shop_page',$ data).... so怎么可能..
我在我的codeigniter安装中使用HMVC。 为此,我将使用类似
$this->load->module("Shops/shop");
$this->Shops->shop_page($data);
这篇文章对我有帮助https://stackoverflow.com/a/14960794/501827
不知道如果您不使用HMVC,这是否行得通,但是有些搜索可能会填补空白。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.