Monday, April 29, 2013

PHP Script to create cache

1). Create Folder Name "cache";
2).
ob_start();
$strUrl = "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];

if(file_exists("cache/".basename($strUrl)))
{
require_once("cache/".basename($strUrl));
}
else
{
echo "This is home page content......................";
}
$fp = fopen("cache/".basename($strUrl),"w");
fwrite($fp, ob_get_contents());
fclose($fp);
ob_end_flush();

No comments:

Post a Comment

Please mention your comments.......