public function del_cache(){
//删除缓存目录下的文件runtime目录下的文件
$path=root_path().'runtime';//runtime
delFileByDir($path);
//return alert('清空缓存成功','index/index',6);
return alert('清空缓存成功','/qingadmin/index/welcome',6);
}
//删除目录及文件,传入目录
function delFileByDir($dir) {
$dh = opendir($dir);//读取文件目录
while ($file = readdir($dh)) {
if ($file != "." && $file != "..") {//去掉.和..这两步
$fullpath = $dir . "/" . $file;//看目录下是不是文件
if (is_dir($fullpath)) {//如果是目录的话
delFileByDir($fullpath);//递归(从内往外删除)
} else {
unlink($fullpath);
}
}
}
closedir($dh);
}