给定以下代码:
session_start();
$cart = $_SESSION['cart'];
print_r($_SESSION['cart']);
然后我可以看到我想要访问的内容:
数组 ( [153c740f526f2fa8aac9e1ddfdce2716] => 数组 ( [deal_id] => 38 [variation_id] => [variation] => [quantity] => 6 [data] =>......
还有更多,但这是基础......
我想要做的是获取并设置数量:
所以我试过:
$cart = $_SESSION['cart'];
for ($i = 0 ; $i < count($cart) ; $i ++)
{
echo "The session variable you want" . $_SESSION['cart'][$i]['deal_id'];
echo "<br>";
}
但是没有输出,我做错了什么?