|
本帖最后由 、林神奇 于 2013-6-12 01:04 编辑
我从form表单获取了这样一个多维数组:
Array
(
[cart] => Array
(
[1] => Array
(
[id] => 1
[name] => 黄扎
[qty] => 1
[price] => 80
)
[2] => Array
(
[id] => 2
[name] => 红扎
[qty] => 2
[price] => 80
)
[3] => Array
(
[id] => 3
[name] => 绿扎
[qty] => 3
[price] => 80
)
)
)
$this->cart->insert($_POST['cart']); //这样执行输出是空数组
CI手册里将多个项目添加到购物车的多维数组方式是这样的:
$data = array(
array(
'id' => 'sku_123ABC',
'qty' => 1,
'price' => 39.95,
'name' => 'T-Shirt',
'options' => array('Size' => 'L', 'Color' => 'Red')
),
array(
'id' => 'sku_567ZYX',
'qty' => 1,
'price' => 9.95,
'name' => 'Coffee Mug'
),
array(
'id' => 'sku_965QRS',
'qty' => 1,
'price' => 29.95,
'name' => 'Shot Glass'
)
);
请问我要怎么样才可以执行成功呢?求大神帮助!!!!
|
|