前端组件调整,剔除无用文件
This commit is contained in:
@@ -35,12 +35,27 @@ class Index extends Admin{
|
||||
*/
|
||||
public function clear(){
|
||||
if ($this->request->isAjax()) {
|
||||
# code...
|
||||
}else{
|
||||
return $this->data;
|
||||
$root = app()->getRootPath() . 'runtime/';
|
||||
$this->delDirAndFile($root);
|
||||
return $this->success('更新成功!');
|
||||
}
|
||||
}
|
||||
|
||||
/** 递归删除文件
|
||||
* @param $dirName
|
||||
* @param bool $subdir
|
||||
*/
|
||||
protected function delDirAndFile($dirName)
|
||||
{
|
||||
$list = glob($dirName . '*');
|
||||
foreach ($list as $file) {
|
||||
if (is_dir($file))
|
||||
$this->delDirAndFile($file . '/');
|
||||
else
|
||||
@unlink($file);
|
||||
}
|
||||
@rmdir($dirName);
|
||||
}
|
||||
/**
|
||||
* @title 后台登录
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user