Home > Backend Development > PHP Tutorial > PHP Cache Check_PHP Tutorial

PHP Cache Check_PHP Tutorial

WBOY
Release: 2016-07-13 17:46:28
Original
912 people have browsed it

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...
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