diff --git a/library/think/cache/driver/File.php b/library/think/cache/driver/File.php index ea5688e5..5c98d799 100644 --- a/library/think/cache/driver/File.php +++ b/library/think/cache/driver/File.php @@ -221,9 +221,13 @@ class File extends Driver $this->rm('tag_' . md5($tag)); return true; } - $fileLsit = (array) glob($this->options['path'] . '*'); - foreach ($fileLsit as $path) { - is_file($path) && unlink($path); + $files = (array) glob($this->options['path'] . ($this->options['prefix'] ? $this->options['prefix'] . DS : '') . '*'); + foreach ($files as $path) { + if (is_dir($path)) { + array_map('unlink', glob($path . '/*.php')); + } else { + unlink($path); + } } return true; } diff --git a/library/think/cache/driver/Lite.php b/library/think/cache/driver/Lite.php index 9e702eed..b9d10097 100644 --- a/library/think/cache/driver/Lite.php +++ b/library/think/cache/driver/Lite.php @@ -180,6 +180,6 @@ class Lite extends Driver $this->rm('tag_' . md5($tag)); return true; } - array_map("unlink", glob($this->options['path'] . $this->options['prefix'] . '*.php')); + array_map("unlink", glob($this->options['path'] . ($this->options['prefix'] ? $this->options['prefix'] . DS : '') . '*.php')); } }