会话变量不在线显示,而是在本地显示

时间:2013-11-08 12:40:54

标签: php session session-variables

在下面的代码中,我在输出页面上打印了一个会话变量

<?php ob_start();
session_start();
include("database.php");
include("tracking-header.php");
?>
<div class="dt-content" style="text-align:center;">
<p class="srymsg">Sorry</p>
<p class="srymsg2" style="margin-bottom:110px;">The Vehicle number <span style="color:#000; font-weight:bold; text-transform:uppercase;"><?php print $_SESSION['vehicleno']; ?></span>, not found.<br />please try again.</p>
 </div>
<div class="nxtbtn" >
<a href="tracking-system-a.php"><input type="button" value="BACK" name="back" style="float:left;margin:17px 25px 16px;"  /></a>
<?php include("tracking-footer.php");?>
print $_SESSION['vehicleno'];中的

显示在本地,但是当我在线上传此文件时,页面上不会显示此文件。任何人都可以说出它的问题是什么?

1 个答案:

答案 0 :(得分:0)

尝试切换ob_start和session_start函数的位置,如下所示

<?php 
session_start();
ob_start();
include("database.php");
include("tracking-header.php");
?>
<div class="dt-content" style="text-align:center;">
<p class="srymsg">Sorry</p>
<p class="srymsg2" style="margin-bottom:110px;">The Vehicle number <span style="color:#000; font-weight:bold; text-transform:uppercase;"><?php print $_SESSION['vehicleno']; ?></span>, not found.<br />please try again.</p>
 </div>
<div class="nxtbtn" >
<a href="tracking-system-a.php"><input type="button" value="BACK" name="back" style="float:left;margin:17px 25px 16px;"  /></a>
<?php include("tracking-footer.php");?>