if($_POST['submit']=='Save'){
$_SESSION['quantity'] = $_POST['quantity'];
$_SESSION['order'] = array_combine($_SESSION['parts-order'], $_SESSION['quantity']);
header("Location: shopping.php");
exit;
}
两个$ _SESSION数组都是430长,都包含字符串。当我分别在两个$ _SESSION数组上print_r()时,它们返回它们的预期值。基本上,当我组合数组时,我期望这个输出:
Array
(
[1 inch ratchet tie down] => 13
[24" White Ring Buoy w/ Reflective Tape] => 4
[50' Throw Line w/bag] => 5
[Classic Shirt Large] => 0
...
)
Y'知道,或者$ _SESSION ['数量']中的任何值。相反,我得到了这个:
Array
(
[1 inch ratchet tie down] => 0
[24" White Ring Buoy w/ Reflective Tape] => 0
[50' Throw Line w/bag] => 0
[Classic Shirt Large] => 0
...
)
除非每个$ _SESSION ['数量']值相同,否则它会产生0.如何在array_combine的过程中将值更改为0?
感谢。