控制器
<?php
namespace app\admin\controller;
use app\admin\controller\Base;
use think\Db;
use think\Cache;
class Clear extends Base
{
public function clear_sys_cache()
{
/*清除模版缓存 删除cache目录*/
$result = Cache::clear();
/*清除模版缓存 删除 temp目录*/
$result2 = array_map('unlink', glob(TEMP_PATH . '/*.php'));
rmdir(TEMP_PATH);
if ($result and $result2) {
$this->success('清除成功', 'index/index');
}else{
return $this->error('清除失败',url('clear_sys_cache'));
}
}
}
————————————————
版权声明:本文为CSDN博主「skalpat」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_40270754/article/details/86432095