我有一个非常奇怪的问题,我的会话变量在localhost和实时服务器上正常工作。一段时间后,我的会话变量开始变空。我能够显示它们的值,但现在会话变量显示为空,下面的代码显示了我的两个页面的问题。
include 'config.php';
include 'database.php';
ob_start();
session_id("oneway");
session_start();
elseif (isset($_POST['airport_way'])) {
$_SESSION["name"] = $_POST['name'];
$_SESSION["email"] = $_POST['email'];
$_SESSION["phone"] = $_POST['phone'];
if (isset($_POST['airport_p'])) {
$_SESSION['convo']=$_POST['airport_p'];
}
$_SESSION['airport']=$_POST['airport'];
$_SESSION['date']=$_POST['date_airport'];
$_SESSION['time']=$_POST['time_airport'];
header('Location: airport.php');
}
现在在airport.php我有
<?php
session_start();
include 'config.php';
include 'database.php';
?>
<h4>Type Of Journey Airport:<?php echo $_SESSION['convo']; ?></h4>
答案 0 :(得分:0)
包含您的文件后开始您的会话:
<?php
include 'config.php';
include 'database.php';
// start session here
session_start();
?>
...
那应该有用