尝试更改您的会话代码,因为这是最好的方法.
原文链接:https://www.f2er.com/php/131103.html例如:
的index.PHP
<?PHP session_start(); if (isset($_POST['username'],$_POST['password']) { $_SESSION['username'] = $_POST['username']; $_SESSION['password'] = $_POST['password']; echo '<a href="nextpage.PHP">Click to continue.</a>'; } else { // form } ?>
nextpage.PHP
<?PHP session_start(); if (isset($_SESSION['username'])) { echo $_SESSION['username']; } else { header('Location: index.PHP'); } ?>