新建一個html.php文件
加入以下代碼
<?php
set_time_limit(0);
//你網站的CMS根網址,結束不要加 /
$baseCmsUrl = "http://www.gjgbw.com";
//動態主頁的名稱
$dmPageName = "index.php";
//靜態主頁的名稱
$stPageName = "index.html";
//你希望多長時間更新一次,單位是秒
$mkTime = 3600;
//下面是執行的代碼
$tureStFile = dirname(__FILE__).'/'.$stPageName;
$ftime = @filemtime($tureStFile);
if(!file_exists($tureStFile) || ($ftime < time()-$mkTime))
{
        $body = file_get_contents($baseCmsUrl.'/'.$dmPageName);
        $fp = fopen($tureStFile, 'w');
        fwrite($fp, $body);
        fclose($fp);
}
?>
然后再首頁模板引入下面代碼
<script language='javascript' src='html.php'></script>