我需要帮助。在我的网站上,我使用 URL 参数来决定要在页面上包含哪些其他 PHP 文件。我的第一个问题是:index.php 中应该有什么,包含的 PHP 文件中应该有什么?
在互联网上我找到了说明,为 index.php 建议了这个结构:
<html>
<head>
<?php include 'header.php'; ?>
</head>
<body>
<?php include 'menu.php'; ?>
<?php include 'content.php'; /* Including page based on the parameters in the url */ ?>
</body>
</html>
使用这种结构,如何<head>
根据 中的内容更改部分中的数据content.php
?例如,对于index.php?option=article&id_article=1
,我将包含article.php
并显示 id 为 1 的文章。那么,如何更改在包含文章之前编写的<title>
、<meta
> 等内容?<head>
谢谢!