修复 检测模板缓存是否有效 方法bug, 先判断缓存文件是否存在, 如果文件不存在而直接调用filemtime会报错

This commit is contained in:
翟帅干
2016-05-12 18:05:10 +08:00
parent 67cebd8ca1
commit dfd1f499fb

View File

@@ -52,13 +52,16 @@ class File
/**
* 检查编译缓存是否有效
* @array $templates 用到的模板文件及更新时间列表
* @string $cacheFile 缓存的文件名
* @int $cacheTime 缓存时间
* @return boolean
*/
public function check($cacheFile, $cacheTime)
{
// 缓存文件不存在, 直接返回false
if (!file_exists($cacheFile)) {
return false;
}
if (0 != $cacheTime && time() > filemtime($cacheFile) + $cacheTime) {
// 缓存是否在有效期
return false;