日期:2014-05-17  浏览次数:20551 次

PHP缓存检查

function checkfile($file,$cachetime=60)
{
?$file=ROOT_PATH.'/data/cache/'.$file.'.php';

?if(is_file($file))
?{

//如果文件修改(右键点击这个文件属性,有一个:修改时间)+缓存时间60秒 > 当前系统时间,说明缓存未过期
??if((filemtime($file)+$cachetime>time()) || !$cachetime)
??{
???return true; //不更新文件
??}
??else
??{
???return false;? //更新文件
??}
?}
?return false;
}