/** * 清空系统缓存,递归删除文件夹 */
public function cleanCache(){ delFile(RUNTIME_PATH); Cache::clear(); $this->success("操作完成!!!",U('Admin/Admin/index')); exit(); return $this->fetch(); } function delFile($path,$delDir = FALSE) { if(!is_dir($path)) return FALSE; $handle = @opendir($path); if ($handle) { while (false !== ( $item = readdir($handle) )) { if ($item != "." && $item != "..") is_dir("$path/$item") ? delFile("$path/$item", $delDir) : unlink("$path/$item"); } closedir($handle); if ($delDir) return rmdir($path); }else { if (file_exists($path)) { return unlink($path); } else { return FALSE; } } }