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

PHP缓存稽查

WBOY
Release: 2016-06-13 13:09:22
Original
950 people have browsed it

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template