这样不行么

WBOY
WBOYOriginal
2016-06-23 14:22:351157browse

$_SESSION[]['id']=$row['id'];
foreach ($_SESSION['id'] as $key=>$value){

echo $value;
}


回复讨论(解决方案)

$_SESSION[]['id']=$row['id'];
这是不行的!
未指定的项只能出现在最后比如
$_SESSION['id'][] = $row['id'];

改成这样看一下!
$_SESSION['id']=$row['id'];
foreach ($_SESSION as $key=>$value){
echo $value;

?>

不是 $_SESSION['id']=$row['id'];这个只能存一个 我存很多个id

然后遍历出来

不是跟你说了吗 $_SESSION['id'][] = $row['id'];

$_SESSION['id'][]=$row['id'];foreach ($_SESSION as $value1){foreach ($value1 as $value2){echo $value2;}}

<?php$row['id']='cs';$_SESSION['id'][]=$row['id'];foreach ($_SESSION[id] as $value){echo $value;}?>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn