0

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

<?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'];显示在本地但是当我在线上传这个文件然后它没有显示在页面上。任何人都可以说它有什么问题吗?

4

1 回答 1

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");?>
于 2013-11-08T12:44:48.903 回答