我怎么能使用 php die 函数来阻止某些 div 加载?我知道它可能与死机不完全相同,但是我如何才能仅阻止特定的 div 加载?所以我希望不加载学习“col”和“col last”,而是加载 div id 栏。另外,如何使 if 语句中的 H2 标记不适用于 else 语句中的表?
<html>
<body>
<div id="header">
<div id="site">
<h1><a href="#">site</a></h1>
</div>
<div id="menuholder">
<ul id="menu">
<li><a href="index.html">Home</a></li>
<li class="active"><a href="about.php">about application</a></li>
<li><a href="#">register</a></li>
<li><a href="#">contact</a></li>
</ul>
</div>
</div>
<div id="teaser">
<div class="wrap">
<div id="image"></div>
<div class="box">
<?php
session_start ();
if (isset($_SESSION['username']))
echo "<h2>Welcome, ".$_SESSION['username']."!</h2>";
else
die("You must be logged in to view this page.
Register to gain access to learn more about the application.
<form action='login.php' method='POST'>
<table>
<tr><td>Username: </td><td><input type='text' name='username'/></td><td>Password: </td> <td> <input type='password' name='password'/></td> <td><input type='submit' name='submit' value='Login'/></td></tr>
</table>
</form>
");
?>
<p>Information about the application would go here</p>
</div>
</div>
</div>
<div id="bar">
<div class="wrap">
</div>
</div>
<div class="wrap">
<div class="col">
<h3>Learn <span class="red">More</span></h3>
<p>More info </p>
</div>
<div class="col">
<h3>User <span class="red">Statistics</span></h3>
<p>More info</p>
</div>
<div class="col last">
<h3>About <span class="red">Phapsy</span></h3>
<p>More info</p>
</div>
</div>
<div id="footer">
<p class="right">Contact: </p>
</div>