请帮助解决这个问题。 场景很复杂,但实质上是:
first-file.php的内容
<?php
session_start();
$_SESSION['s_Foo'] = "pippo";
/* this is only a twisted way of producing the header('location: second-file.php'), because unfortunately often I obtain the error "headers already sent". */
echo "<!DOCTYPE html><html>";
echo "<head><meta charset='utf-8'></head>";
echo "<body onload='go()'>";
echo "<script>function go(){location.replace(\"second-file.php\")}</script>";
echo "</body>";
echo "</html>";
exit;
?>
second-file.php的内容
<?php
session_start();
$foo = isset($_SESSION['s_Foo']) ? $_SESSION['s_Foo'] : "nothing";
echo $foo;
...
here a line that require to use $_SESSION['s_Foo']
?>
现在,我读了(在secon文件中)“ pippo ”,但只有一半或一秒...... 然后消失“ pippo ”,并在php日志中写入“ nothing ”,注意:未定义的索引:[...] / second-file.php中的s_Foo第4行
提前谢谢你, 弗朗西斯