Jump to content

cacheing pages


batearedfox

Recommended Posts

Hi I'd like to cache a few pages when a link is clicked from a backend admin page. They only need to be updated when the admin changes something and decides to update these pages. I'm using

 

<?php
// start the output buffer
ob_start(); ?>

//Your usual PHP script and HTML here ...

<?php
$cachefile = "cache/home.html";
// open the cache file "cache/home.html" for writing
$fp = fopen($cachefile, 'w');
// save the contents of output buffer to the file
fwrite($fp, ob_get_contents());
// close the file
fclose($fp);
// Send the output to the browser
ob_end_flush();
?>

 

Which is fine for one page but I can't add another page to this script. Is there a good way to adapt this to run for 5 or 6 pages? Thanks for any help.

 

Tom

Link to comment
https://forums.phpfreaks.com/topic/201235-cacheing-pages/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.