require dirname(__FILE__).'/include/common.inc.php'; //定义常用变量,ob_start
$head['title'] = $PHPCMS['sitename'].'_'.$PHPCMS['meta_title'];
$head['keywords'] = $PHPCMS['meta_keywords'];
$head['description'] = $PHPCMS['meta_description']; //html页面标题,keyword,description.seo优化
header('Last-Modified: '.gmdate('D, d M Y H:i:s', TIME).' GMT');
header('Expires: '.gmdate('D, d M Y H:i:s', TIME+CACHE_PAGE_INDEX_TTL).' GMT'); //页面失效时间
header('Cache-Control: max-age='.CACHE_PAGE_INDEX_TTL.', must-revalidate');
include template('phpcms', 'index'); //调用模板
cache_page(CACHE_PAGE_INDEX_TTL); //生成页面缓存
//include/global.inc.php
function cache_page($ttl = CACHE_PAGE_TTL, $isjs = 0)
{
if($ttl == 0 || !defined('CACHE_PAGE_FILE')) return false; //无需缓存
$contents = ob_get_contents();
if($isjs) $contents = format_js($contents);
dir_create(CACHE_PAGE_DIR);
$contents = "/n".$contents;
file_put_contents(CACHE_PAGE_FILE, $contents); //把页面放入静态页面中。
@chmod(CACHE_PAGE_FILE, 0777);
}