作者:刘洁05_836 | 来源:互联网 | 2018-04-24 02:24
请教各位大神,下面PHP代码中"$_SESSION['cart'][$new]"的使用是什么语法?"if($new){newitemselectedif(!isset($_SESSION['cart'])){$_SESSION['cart']array();$_SESSION['items']0;$_SESSION['total_price']'
sessionphp
请教各位大神,下面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; }