文件
mashangyoujiu/Application/Admin/Controller/UcacheController.class.php

57 行
1.2 KiB
PHP
可执行文件

<?php
namespace Admin\Controller;
use Think\Controller;
//[1.6.73]
/**
* 清除系统缓存
* Class UcacheController
* @package Admin\Controller
*/
class UcacheController extends BaseController
{
public function index()
{
if (IS_POST) {
$dataSize = [
'appPath' => round(getDirSize('./appPath') / 1024),
'tempApp' => round(getDirSize('./tempApp') / 1024),
'runtime' => round(getDirSize('./Application/Runtime') / 1024),
];
$this->ajaxReturn([
'status' => 1,
'msg' => '获取成功',
'data' => $dataSize,
]);
} else {
$this->display();
}
}
/**
* 清除缓存
*/
public function deldir()
{
$file = array(
'appPath' => './appPath',
'tempApp' => './tempApp',
'runtime' => './Application/Runtime',
);
$data = I('post.clear_data');
foreach ($data as $val){
if(isset($file[$val])){
deldir($file[$val]);
}
}
$res = [
'status' => 1,
'msg' => '清除成功',
];
$this->ajaxReturn($res);
}
}