是的,您可以将index.php拆分为header.php/footer.php,然后将它们包含在每个页面上.请注意,您的页面可以不是静态HTML而是PHP脚本,以显示带有一个脚本的多个页面.
我建议也不要像普通的结构那样
include 'header.php';
//do some stuff
include 'footer.php';
Run Code Online (Sandbox Code Playgroud)
但另一种结构,更有用:
//do some stuff, retrieve all data.
include 'header.php';
include 'page.php'; //include page template
include 'footer.php';
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
575 次 |
| 最近记录: |