Home  >  Article  >  Backend Development  >  PHP Cache Check_PHP Tutorial

PHP Cache Check_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 17:46:28895browse

function checkfile($file,$cachetime=60)

{

$file=ROOT_PATH.'/data/cache/'.$file.'.php';

if(is_file($file))

{

//If the file is modified (right-click on the file properties, there is one: modification time) + cache time 60 seconds> current system time, indicating that the cache has not expired

if((filemtime($file)+$cachetime>time()) || !$cachetime)

{

Return true; //Do not update file

}

else

{

Return false; //Update file

}

}

return false;

}

Author: Huangcun Tingyu

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478582.htmlTechArticlefunction checkfile($file,$cachetime=60) { $file=ROOT_PATH./data/cache/.$ file..php; if(is_file($file)) { //If the file is modified (right click on the file properties, there is one: modification time...
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