我有这个代码
$_SESSION['id'][] = $link;
这是真的,结果是这样的
Array ( [id] => Array ( [0] => 4 [1] => 3 [2] => 2 [3] => 1 [4] => 4 [5] => 4 [6] => 1 [7] => 1 [8] => 1 [9] => 1 [10] => 1 [11] => 1 [12] => 1 ) )
我想显示数组中的每个索引
foreach($_SESSION as $key=>$value){
echo $key;
echo $value;
echo $_SESSION[$key][$value];
echo '<br />';
}
怎么可以?
这是 foreach 的结果
id Notice: Array to string conversion in ajax\ajax.php on line 18
Array Warning: Illegal offset type in ajax\ajax.php on line 19
第 18 和 19 行
echo $value;
echo $_SESSION[$key][$value];