我想知道如何在不刷新頁眉的情況下重新加載內容。我在下面創建了一個小樣本代碼。php中的靜態頁眉佈局
的header.php
<html>
<head>
</head>
<body>
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="index2.php">News</a></li>
</ul>
的index.php
<?php
include("header.php");
?>
<div>
This is contents 1
</div>
</body>
</html>
index2.php
<?php
include("header.php");
?>
<div>
This is contents 2
</div>
</body>
</html>
我認爲指數index2頁面作爲內容頁面。
當我點擊主頁或新聞鏈接時,內容頁面會加載,但每次點擊時也會刷新header.php。
我想知道,如何加載內容頁面時,請點擊首頁鏈接時不帶新鮮的header.php。
任何想法用php或javascripts做到這一點?
恭喜它也有效。如果你能接受我的答案,它也會幫助我:D,試圖建立一個可以信任的賬戶:) –