Often the homepage of JS, business code plus too much, resulting in slow page access, you can change the homepage to static access, access speed will be improved, but if you update the first page data, and can not update, but you set the time fixed update once
The code is as follows:
<?php
$nowtime =time ();
$pastsec = $nowtime-$_get["T"];
if ($pastsec <3600)
{
Exit 5 minutes Update, time can adjust itself
}
Ob_start (); Open buffer
Include ("index.php");
$content =ob_get_contents (); Get the contents of the buffer zone
$content. = "\n<script language=javascript src=\" m.php?t= ". $nowtime." \ "></script>"; Plus the code that calls the updater
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);
}
}
?>
Provided by Hefei Xin Yi Studio
PHP Homepage timed static page generation