我很难弄清楚我的 php 代码在变量传递或我的 php 语法方面有什么问题。所以这是包含 start_session(); 的 php。这些位于需要共享变量的页面的顶部。
<?php
error_reporting(E_ALL ^ E_NOTICE);
session_start();
$CustNum = $_SESSION['CustNum'];
$UserName = $_SESSION['UserName'];
?>
然后这是正文代码。
<?php
if($UserName && $UserID)
echo ("Welcome <b>$UserName</b>. <br> <a href='index.php'><b>Log Out</b></a>");
else
echo ("Please log in to access this page.<br><a href='login.php'>Log In Here</a>");
?>
这是网页中打印的结果:
"$UserName.
Log Out"); else echo ("Please log in to access this page.
Log In Here"); ?> "
谁能告诉我问题是什么。谢谢!