当前位置:网站首页>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('清除成功');
}
}
边栏推荐
- leetcode--链表
- 【输入法】迄今为止,居然有这么多汉字输入法!
- Time Series Data Augmentation for Deep Learning: A Survey 之论文阅读
- Chapter 7 operation bit and bit string (III)
- 2021-05-20computed and watch applications and differences
- "I can't understand Sudoku, so I choose to play Sudoku."
- Niuke network decimal integer to hexadecimal string
- 【Redis实现秒杀业务①】秒杀流程概述|基本业务实现
- Mba-day25 best value problem - application problem
- Implementation process of tcpdump packet capturing
猜你喜欢

Numpy numpy中的np.c_和np.r_详解

Leetcode -- wrong set

On the routing tree of gin

活动报名|Apache Pulsar x KubeSphere 在线 Meetup 火热报名中

MySQL data (Linux Environment) scheduled backup

Lu Qi: I am most optimistic about these four major technology trends

Data middle office: detailed explanation of technical architecture of data middle office

Yolox backbone -- implementation of cspparknet

Epidemic situation, unemployment, 2022, we shouted to lie down!

普通人没有学历,自学编程可以月入过万吗?
随机推荐
Essay - Reflection
1844. replace all numbers with characters
Microblog writing - flow chart - sequence chart - Gantt chart - Mermaid flow chart - good results
From the Huawei weautomate digital robot forum, we can see the "new wisdom of government affairs" in the field of government and enterprises
Groovy通过withCredentials获取Jenkins凭据
牛客网 实现简单计算器功能
MySQL - SQL statement
目标检测系列——Fast R-CNN
【LeetCode】541. Reverse string II
Webrtc series - network transmission 5: select the optimal connection switching
深入了解 border
2022.06.23 (traversal of lc_144,94145\
2022-06-23: given a nonnegative array, select any number to make the maximum cumulative sum a multiple of 7, and return the maximum cumulative sum. N is larger, to the 5th power of 10. From meituan. 3
[use picgo+ Tencent cloud object to store cos as a map bed]
Zero foundation self-study SQL course | having clause
Target detection series fast r-cnn
4274. suffix expression
Redis实现全局唯一ID
Zero foundation self-study SQL course | syntax sequence and execution sequence of SQL statements
荐书丨《好奇心的秘密》:一个针尖上可以站多少跳舞的小天使?