当前位置: 代码迷 >> PHP >> PHP缓存稽查
  详细解决方案

PHP缓存稽查

热度:57   发布时间:2016-04-28 23:37:55.0
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;
}

  相关解决方案