我正在学习,我需要我的索引来运行我的页面,而不是使用php if语句使用php进行链接,并且我的代码中缺少某些内容。它只是一遍又一遍地运行我的头文件。
我的if语句:
<?php
if (!isset($_GET['page']))
{
require('index.php');
}
else if ($_GET['page'] == 'aboutus') {
if (!isset($_GET['action'])) {
require('aboutus.php');
} else if ($_GET['action'] == 'store') {
require('store.php');
} else if ($_GET['action'] == 'contactus') {
require('contactus.php');
}
else
{
require('index.php');
}
}
else
{
require('index_.php');
}
?>
我的导航栏:
<ul class="nav">
<li><a href="?page=index.php">Home</a></li>
<li><a href="?page=aboutus.php">About</a></li>
<li><a href="?page=store.php">Current Items</a></li>
<li><a href="?page=contactus.php">Contact Us</a></li>
</ul>
我知道我缺少什么,我不确定是什么。
为什么???您可以实现URL仅更改ater hashTag的单页应用程序,例如:
link.url/index#about-us
link.url/index#store
and ...
关于您的问题,在要求您继续执行代码之后,必须在每个要求之后都按die;
来完成循环。