diff --git a/library/think/cache/driver/File.php b/library/think/cache/driver/File.php index 93d321f232..2e57e9a5c6 100644 --- a/library/think/cache/driver/File.php +++ b/library/think/cache/driver/File.php @@ -130,7 +130,8 @@ public function get($name, $default = false) return $default; } - $content = file_get_contents($filename); + $content = @file_get_contents($filename); + $this->expire = null; if (false !== $content) { @@ -245,11 +246,7 @@ public function dec($name, $step = 1) public function rm($name) { $this->writeTimes++; - - try { - return $this->unlink($this->getCacheKey($name)); - } catch (\Exception $e) { - } + return $this->unlink($this->getCacheKey($name)); } /** @@ -299,7 +296,11 @@ public function clear($tag = null) */ private function unlink($path) { - return is_file($path) && unlink($path); + try { + return is_file($path) && unlink($path); + } catch (\Exception $e) { + return false; + } } }