/*清除缓存文件*/ public function clearRuntime() { $this->delFileByDir(RUNTIME_PATH); $this->success('删除缓存成功!'); }
/** * 递归删除缓存文件 * @param $dir */ public function delFileByDir($dir) { $dh = opendir($dir); while ($file = readdir($dh)) { if ($file != "." && $file != "..") { $fullpath = $dir . "/" . $file; if (is_dir($fullpath)) { $this->delFileByDir($fullpath); } else { unlink($fullpath); } } } closedir($dh); }