<?php
// define name and path to file with cache
$cachefile = 'cached-files/'.date('M-d-Y').'.php';
// time to store. I define 5 hours
$cachetime = 18000;
// If time not runs out, then add it
if (file_exists($cachefile) && time() - $cachetime < filemtime($cachefile)) {
include($cachefile);
exit;
}
// if time passed by, load it
ob_start();
?>
<html>
output all your html here.
</html>
<?php
//add new page cache
$fp = fopen($cachefile, 'w');
fwrite($fp, ob_get_contents());
fclose($fp);
ob_end_flush();
?>
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.