Home  >  Article  >  Backend Development  >  PHP缓存稽查

PHP缓存稽查

WBOY
WBOYOriginal
2016-06-13 10:49:40839browse

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;
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn