您的位置:首页 > 编程语言 > PHP开发

phpcms2008 代码简介:index.php

2009-08-06 18:26 363 查看
<?php
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 = "<!--expiretime:".(TIME + $ttl)."-->/n".$contents;
file_put_contents(CACHE_PAGE_FILE, $contents);  //把页面放入静态页面中。
@chmod(CACHE_PAGE_FILE, 0777);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: