2016-03-06 47 views
0

我已经创建的索引文件,它看起来像neworder.html这个如何保持页眉页脚和改变主要内容?

<php 
    include 'HTMLS/header.html'; 
    include 'neworder.php'; 
    include 'HTMLS/fotter.html'; 
?> 

用户开始,并从那里,他可以选择移动到4次不同的页面。 我想在所有页面上保留页眉和页脚。 它是如何做到的?

+0

使用'include()'要求您的文件具有'.php'扩展名。所以,'neworder.html'应该改为'neworder.php'。如果你的问题也包含其他文件的内容,这可能会有所帮助。 –

回答

0

就包括头,每一页的页脚文件,并更改内容文件

第1页

<php 
    include 'HTMLS/header.html'; 
    include 'page1.php'; 
    include 'HTMLS/fotter.html'; 
?> 

第2页

<php 
    include 'HTMLS/header.html'; 
    include 'page2.php'; 
    include 'HTMLS/fotter.html'; 
?> 

...等。

0

如果您不想重新加载页面,您必须在PHP代码之外完成此操作,例如,通过使用Ajax请求。

相关问题