通过单击index.php中的header.php,如何将content .php更改为content1 .php


By clicking the header.php inside the index.php, how can the cotent.php will change to cotent1.php?

在index.php中,它包括以下3个页面

<?php include 'header.php'; ?>
<?php include 'content.php'; ?>
<?php include 'footer.php'; ?>

对于header.php,它是一个像附加图片菜单和内容图片一样的菜单。

现在的问题是在我点击菜单后,我想把content.php更改为另一个页面,如content1.php。否则content.php中的内容就会改变。这怎么可能发生在我的index.php当header.php被点击,content.php将更改为content1.php它的内容在content.php将更改到我想要的。

请告知,我的电子邮件是andybusy@hotmail.com。谢谢你。

安迪

try this

<?php include 'header.php'; ?>
<?php if(isset($_GET['pagename']))
{
 $pagename=$_GET['pagename'].'.php';
}
else
{
$pagename='content.php';
}
?>
<?php include $pagename; ?>
<?php include 'footer.php'; ?>

这是你的链接

<a href="index.php?pagename=content">page1</a>
<a href="index.php?pagename=content1">page2</a>
<a href="index.php?pagename=content2">page3</a>