<?php if(!isset($_SESSION['login'])) { ?>
<div id="login">
<form method="post" action="login.php">
Username: <input type="text" name="nm" /> <br />
Password: <input type="password" name="pass" /> <br />
<input type="submit" name="go" value="Login" />
</form>
</div>
<?php } else echo 'hi'; ?>
即使会话已设置(值为Test),它也会显示表单而不是“Hi”。