我尝试将 $_SESSION["avalue"] 从 request.php 文件扔到 response.php 文件,如下所示:
request.php:
<?php
$_SESSION["across"] = "across Session";
?>
<script type="text/javascript">
function requestExample(){
xmlhttp.open("POST", "../response.php?Name=Example", true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send();
}
</script>
... .......
Response.php:
<?php
if(isset($_GET["Name"]))
{
$name = $_GET["Name"];
switch($name){
case "Example":
echo $_SESSION["across"];
break;
......
}
}
?>
我收到错误:未定义的索引:在 ......../response.php 中