請教各位大神,下面PHP代碼中"$_SESSION['cart'][$new]"的使用是什麼語法?
if($new) {
//new item selected
if(!isset($_SESSION['cart'])) {
$_SESSION['cart'] = array();
$_SESSION['items'] = 0;
$_SESSION['total_price'] ='0.00';
}
if(isset($_SESSION['cart'][$new])) {
$_SESSION['cart'][$new]++;
} else {
$_SESSION['cart'][$new] = 1;
}
$_SESSION['cart']你不是存儲了array,就是動態給array增加$new屬性賦值為1,如果已經存在過$new屬性,則+1,應該是購物車的代碼