当前位置:网站首页>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('清除成功');
}
}
边栏推荐
- Digital cloud released the 2022 white paper on digital operation of global consumers in the beauty industry: global growth solves marketing problems
- The list of open source summer winners has been publicized, and the field of basic software has become a hot application this year
- NETRCA: AN EFFECTIVE NETWORK FAULT CAUSE LOCALIZATION之论文阅读
- 牛客网 十进制整数转十六进制字符串
- From the Huawei weautomate digital robot forum, we can see the "new wisdom of government affairs" in the field of government and enterprises
- 荐书丨《好奇心的秘密》:一个针尖上可以站多少跳舞的小天使?
- [Niuke] length of the last word of HJ1 string
- Huawei Router: GRE Technology
- Tools
- 1528. rearrange strings
猜你喜欢

Yolox backbone -- implementation of cspparknet

普通人没有学历,自学编程可以月入过万吗?

深入解析 Apache BookKeeper 系列:第三篇——读取原理
Depens:*** but it is not going to be installed

How to configure environment variables and distinguish environment packaging for multi terminal project of uniapp development

解决:jmeter5.5在win11下界面上的字特别小

Time Series Data Augmentation for Deep Learning: A Survey 之论文阅读

嵌入式 | 硬件转软件的几条建议

CF566E-Restoring Map【bitset】

When programmers are asked if they can repair computers... | daily anecdotes
随机推荐
Remote connection of raspberry pie without display by VNC viewer
【bug】@JsonFormat 使用时出现日期少一天的问题
MYCAT read / write separation and MySQL master-slave synchronization
2022.06.23 (traversal of lc_144,94145\
Threejs glow channel 01 (unrealbroompass & layers)
[noi simulation] pendulum (linear algebra, Du Jiao sieve)
Applet wx show
小白学习MySQL - 增量统计SQL的需求
当程序员被问会不会修电脑时… | 每日趣闻
Some common pitfalls in getting started with jupyter:
怎么把mdf和ldf文件导入MySQL workbench中
支持向量机(SVC,NuSVC,LinearSVC)
Support vector machine (SVC, nusvc, linearsvc)
每周推荐短视频:谈论“元宇宙”要有严肃认真的态度
[use picgo+ Tencent cloud object to store cos as a map bed]
【LeetCode】415. String addition
4275. Dijkstra sequence
[bug] @jsonformat has a problem that the date is less than one day when it is used
Framework tool class obtained by chance for self use
leetcode--链表