修复File缓存方式下,clear报错误

linux可能出现 . 或者 .. 特殊目录,在进行is_dir时,会报错
This commit is contained in:
shuipf
2016-03-30 13:30:22 +08:00
parent ad6d96f0e4
commit 05cbf1c146

View File

@@ -186,18 +186,11 @@ class File
*/ */
public function clear() public function clear()
{ {
$path = $this->options['path']; $fileLsit = (array)glob($this->options['path'].'*');
if ($dir = opendir($path)) { foreach ($fileLsit as $path) {
while ($file = readdir($dir)) { is_file($path) && unlink($path);
$check = is_dir($file);
if (!$check) {
$this->unlink($path . $file);
}
}
closedir($dir);
return true;
} }
return true;
} }
/** /**