public function viemore(){
$article_ids = I('get.article_id');
$arts_statis_file = HTML_PATH."art/art_".$article_ids.".html";
$content = $this->fetch('./viemore');
//检查缓存文件是否存在,并且采用模板文件
if(file_exists($arts_statis_file) && (time() - filemtime($arts_statis_file) < C('time'))){
$this->display(HTML_PATH."art/art_".$article_ids.".html");
exit;
}
...处理数据,最后获取模板。
//获取模板
$content = $this->fetch('./viemore');
file_put_contents($arts_statis_file,$content);
$this->display('./viemore');
}
ThinkPHP的静态缓存,非系统写法。
最新推荐文章于 2025-08-13 23:08:01 发布