if($new)
{
//new item selected
if(empty($_SESSION["cart"])) // 判断语句好像不对?
{
$_SESSION["cart"] = array();
......
}
if(!empty($_SESSION['cart'][$new]))
$_SESSION['cart'][$new]++;
else
$_SESSION['cart'][$new] = 1;
}
{
//new item selected
if(empty($_SESSION["cart"])) // 判断语句好像不对?
{
$_SESSION["cart"] = array();
......
}
if(!empty($_SESSION['cart'][$new]))
$_SESSION['cart'][$new]++;
else
$_SESSION['cart'][$new] = 1;
}
if(empty($_SESSION["cart"]))
{
}
这样判断不行阿!根本不会进到if语句中,empty的结果是false。也就无法进行注册。
不好意思,刚刚又试了一下,你的判断是对的。empty的结果是true。