嘿伙计们,这是我正在使用的代码
$ch="s1";
$_SESSION[$ch] = array();
$_SESSION[$ch][] = $_POST['t0'];
$_SESSION[$ch][] = $_POST['t1'];
$_SESSION[$ch][] = $_POST['t2'];
$_SESSION[$ch][] = $_POST['t3'];
$_SESSION[$ch][] = $_POST['t4'];
$_SESSION[$ch][] = $_POST['t5'];
$_SESSION[$ch][] = $_POST['t6'];
但是当我在屏幕上打印会话数据时$_SESSION['s1'][0]
,所有其他索引的所有数据$_SESSION['s1'][1]
都$_SESSION['s1'][6]
没有显示。
这是结果var_dump($_SESSION)
;
's1' => array (size=7)
0 => string 'All Purpose Horn Anvil A-1t1=Shipping Weight: 900gmst2=Price: € 5.00t3=Quantity: t4= t5=56t6=All Purpose Horn Anvil A-1 Shipping Weight: 900gms Price: € 5.00 Quantity: 56' (length=192)
1 => null
2 => null
3 => null
4 => null
5 => null
6 => null
出于某种原因,POST 索引(即 t0 到 t6)显示在 s1 中。