2
我的網站有一個登陸頁面,它顯示了每個大陸懸停鏈接的世界地圖。點擊該有一個A HREF鏈接是這樣的:PHP會話變量不起作用
<a href="setsession.php?c=AU">Australia</a>
setsession.php只包含這個:
<?php
session_start();
$_SESSION['SelectedCountry'] = htmlspecialchars($_GET["c"]);
header("location:test/index.php");
?>
和測試/ index.php文件包含:
<?php
session_start();
echo $_SESSION['SelectedCountry'];
?>
,所以我可以不知道爲什麼test/index.php只顯示一個空白頁面?
間隔也許? 'header(「Location:test/index.php」);' –
嘗試在index.php之後的echo ...,print_r($ _ SESSION);檢查會話SelectedCountry是否已設置 – CMPS
它轉發沒問題test/index.php。問題是test/index.php只顯示一個空白頁面而不是回顯會話變量。 – JaceG