我填写这样的会话:
$_SESSION[$id]=$value;
我正在用这个读出数组:
foreach($_SESSION AS $value){...}
但是我怎样才能读出$id
会话的内容呢?数组键?
谢谢!
foreach($_SESSION as $key => $value){
}
您需要以下内容:
foreach($_SESSION AS $key => $value) {
echo "$key -> $value";
}
foreach ($_SESSION as $key => $value)
foreach ($_SESSION as $key => $value) {
echo $key ;
echo $value;
}
foreach ($_SESSION as $key => $value) {
print $key . '<br>';
print $value;
}
$array = array();
/*$array = array(0 => "Value");*/
$array[0] = "Value";
$_SESSION["array"] = $array;
/*$_SESSION["array"][0]= "Value 2";*/
foreach($_SESSION["array"] as $key => $value){
print $key;
print $value;
}