首页生成html代码
1.
<?php
set_time_limit(0);
//你网站的CMS根网址,结束不要加 /
$baseCmsUrl = “http://x.com“;
//动态主页的名称
$dmPageName = “index.php”;
//静态主页的名称
$stPageName = “index.html”;
//你希望多长时间更新一次,单位是秒
$mkTime = 300;
//下面是执行的代码
$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);
}
?>
2、运行 http://x.com/r.php 生成 index.html
3、打开 index.html 结尾加入:
<script type=”text/javascript” src=”r.php”></script>