改进File缓存的clear方法

This commit is contained in:
thinkphp
2017-11-27 15:42:50 +08:00
parent 6381d65bb3
commit 3c04624c56

View File

@@ -226,7 +226,10 @@ class File extends Driver
$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'));
$matches = glob($path . '/*.php');
if (is_array($matches)) {
array_map('unlink', $matches);
}
rmdir($path);
} else {
unlink($path);