我正在做下列事情,但它不起作用。它只有數組中的1項不管我有多少添加如何添加到PHP中的數組?
有人可以告訴我,我做錯了什麼
session_start();
$pid = mysql_real_escape_string(trim($_GET["pid"]));
$price = mysql_real_escape_string(trim($_GET["price"]));
$quantity = mysql_real_escape_string(trim($_GET["quantity"]));
if (!isset($_SESSION['cart'])) {
$_SESSION['cart'] = array();
$_SESSION['cart']['pid'] = $pid;
$_SESSION['cart']['total_price'] = $price;
$_SESSION['cart']['total_items'] = $quantity;
}else{
$_SESSION['cart']['pid'] = $pid;
$_SESSION['total_price'] += $price;
$_SESSION['total_items'] += $quantity;
}
誰給-1,甚至不打擾解釋原因留下評論?這篇文章遵循SO中的所有規則。明確的問題,OP已經付出了努力....還有什麼我錯過了? – itachi 2012-04-25 19:09:11