当前位置:网站首页>Thinkphp5清除runtime下的cache缓存,temp缓存,log缓存
Thinkphp5清除runtime下的cache缓存,temp缓存,log缓存
2022-06-24 08:08:00 【BigChen_up】
主要使用的php函数有:
array_map ( callback , array1 ,array… )
array_map --为数组的每个元素应用回掉函数
参数1:回掉函数,应用到每个数组里的每个元素
参数2:数组,便利运行参数1设置的函数
返回数组,包含回掉函数处理之后 array1 的所有元素。
glob(pattern,flags)
glob — 寻找与模式匹配的文件路径
参数1:必须。规定检索模式。
参数2:可选。规定特殊的设定。这里就不过多介绍了因为这里用不到。
想要实现效果的话可以直接复制以下代码:
<?php
namespace app\admin\controller;
use think\Cache;
class CacheController {
// 清除缓存不删除cache
public function clearCache() {
Cache::clear();
$this->success("清除成功");
}
// 清除模版缓存但不删除temp目录;
public function clearTemp() {
array_map('unlink',glob(TEMP_PATH.'*.php'));
$this->success('清除成功');
}
// 清除日志缓存并删出log空目录
public function clearLog() {
$path = glob(LOG_PATH . '*');
foreach ($path as $val) {
array_map('unlink', glob($val . DS . '*.log'));
rmdir($val);
}
$this->success('清除成功');
}
}
边栏推荐
- MySQL - SQL statement
- Get post: do you really know the difference between requests??????
- 解决:jmeter5.5在win11下界面上的字特别小
- Threejs glow channel 01 (unrealbroompass & layers)
- 当程序员被问会不会修电脑时… | 每日趣闻
- Huawei Router: GRE Technology
- linux(centos7.9)安装部署mysql-cluster 7.6
- 2022.06.23 (traversal of lc_144,94145\
- On the routing tree of gin
- 1528. rearrange strings
猜你喜欢
Depens:*** but it is not going to be installed

Leetcode -- wrong set

荐书丨《好奇心的秘密》:一个针尖上可以站多少跳舞的小天使?

Kaformer personal notes

【ES6闯关】Promise堪比原生的自定义封装(万字)

支持向量机(SVC,NuSVC,LinearSVC)

Transplantation of xuantie e906 -- fanwai 0: Construction of xuantie c906 simulation environment

读CVPR 2022目标检测论文得到的亿点点启发

Easyexcel single sheet and multi sheet writing

Ordinary people have no education background. Can they earn more than 10000 yuan a month by Self-taught programming?
随机推荐
小白学习MySQL - 增量统计SQL的需求
Data middle office: middle office architecture and overview
Epidemic situation, unemployment, 2022, we shouted to lie down!
零基础自学SQL课程 | 子查询
深入了解 border
I heard that you are still spending money to buy ppt templates from the Internet?
【LeetCode】387. First unique character in string
Weekly recommended short video: is the ultimate form of computing "meta universe"?
Numpy numpy中的np.c_和np.r_详解
MySQL data (Linux Environment) scheduled backup
Spark - the number of leftouterjoin results is inconsistent with that of the left table
Installation of sophus package in slam14 lecture
Digital cloud released the 2022 white paper on digital operation of global consumers in the beauty industry: global growth solves marketing problems
YOLOX backbone——CSPDarknet的实现
从618看京东即时零售的野心
Every (), map (), forearch () methods. There are objects in the array
Redis实现全局唯一ID
每周推荐短视频:计算的终极形态是“元宇宙”?
【输入法】迄今为止,居然有这么多汉字输入法!
Data middle office: middle office practice and summary