页面缓存

缓存目录(caches_tmp/test.tmp.php)

模板页面(html/test.html)

$fileHtml = 'html/test.html';

$fileTpl = 'caches_tmp/test.tmp.php'

if(file_exist($fileTmp) && @filetime($fileTmp) > @filetime($fileHtml)) {

  return $fileTmp;

} esle {

$template_cache = &System::load_sys_class('template_cache');
if (!is_dir(dirname(dirname($FileTpl)))) {
mkdir(dirname(dirname($FileTpl)), 0777, true)or die("Not Dir");
chmod(dirname(dirname($FileTpl)), 0777);
}
if (!is_dir(dirname($FileTpl))) {
mkdir(dirname($FileTpl), 0777, true)or die("Not Dir");
chmod(dirname($FileTpl), 0777);
}
$PutFileTpl = $template_cache->template_init($FileTpl, $FileHtml, $module, $template);
if ($PutFileTpl)
return $FileTpl;
else
_error('template message', 'The "' . $module . '.' . $template . '" template file does not exist');

}

原文地址:https://www.cnblogs.com/da-guang/p/5417221.html