本文以素材火PHP教程频道http://www.sucaihuo.com/php作为静态缓存示例,你可设置缓存时间,也可加参数删除缓存文件
调用缓存类
require_once('My.Cache.php');
$Cache = new Cache();
缓存"素材火PHP"频道页面,缓存时间5秒
if ($Cache->Start($REQUEST_URI, 5)) {
echo "<div style='margin:15px 0;font-size:20px;text-align:center'>当前时间:<b class='red'>" . date("Y-m-d H:i:s") . "</b>,5秒后再刷新本页面,看下时间有什么变化!</div>";
$content = file_get_contents("example.php");
echo $content;
$Cache->Build();
}
若你想删除缓存,加后缀即可,比如:http://www.sucaihuo.com/php?rebuild=yes
$rebuild = isset($_GET['rebuild'])?$_GET['rebuild']:"";
if ($rebuild == 'yes') {
$Cache->Remove($REQUEST_URI);
}
系统已开启自动识别垃圾评论机制,识别到的自动封号,下载出错或者资源有问题请联系全栈客服QQ 1915635791