在挨踢路看到的教程,不单单议适用于Typecho,wordpress也是能够通用。
教程
在网站根目录新建文件f5.php然后内里写入下面的代码。
<?php$nowtime=time();$pastsec = $nowtime - $_GET["t"];if($pastsec<600){exit; //10分钟更新一次,时候能够本身调解}ob_start(); //翻开缓冲区include("index.php");$content = ob_get_contents(); //获得缓冲区的内容$content .= "\n<script language=javascript src=\"f5.php?t=".$nowtime."\"></script>"; //加上挪用更新程序的代码file_put_contents("index.html",$content);if (!function_exists("file_put_contents")){function file_put_contents($fn,$fs){$fp=fopen($fn,"w+");fputs($fp,$fs);fclose($fp); }}?>然后浏览器翻开你的域名/f5.php,翻开后你将看到的照样你的首页,革新你的网站根目录,看到一个index.html就申明生成胜利了,然后检察首页代码,末端涌现“<script language=javascript>......”之类的字眼,申明你接见的就是index.html的页面,到此,落成!
补充
我的index.html生成胜利了,然则每次接见末端都没有涌现“<script language=javascript>......”之类的字眼,这申明程序默许接见index.php比index.html权限高。须要手动调解下:
假如你用的是宝塔
根据下图,将index.html调解到index.php上边保留即可。
假如你用的是cPanel
在.htaccess中增加DirectoryIndex index.html index.php index.htm保留即可

评论列表