public function cache()
{
if (isset($_GET['type'])) {
$Dir = new \Dir();
$cache = D('Common/Cache');
$type = I('get.type');
switch ($type) {
case "template":
//删除缓存目录下的文件
$Dir->del(RUNTIME_PATH);
$Dir->delDir(RUNTIME_PATH . "Cache/");
$Dir->delDir(RUNTIME_PATH . "Temp/");
//更新开启其他方式的缓存
\Think\Cache::getInstance()->clear();
$this->success("模板缓存清理成功!", U('Index/cache'));
break;
case "logs":
$Dir->delDir(RUNTIME_PATH . "Logs/");
$this->success("站点日志清理成功!", U('Index/cache'));
break;
default:
$this->error("请选择清楚缓存类型!");
break;
}
} else {
$this->display();
}
}