Home > Article > Backend Development > PHP Cache Check_PHP Tutorial
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