当前位置:网站首页>Thinkphp5 clear the cache cache, temp cache and log cache under runtime
Thinkphp5 clear the cache cache, temp cache and log cache under runtime
2022-06-24 09:45:00 【BigChen_ up】
Mainly used php Function has :
array_map ( callback , array1 ,array… )
array_map -- Apply the fallback function for each element of the array
Parameters 1: Fallback function , Apply to every element in every array
Parameters 2: Array , Convenient operating parameters 1 Set function
Returns an array of , After including the fallback function processing array1 All elements of .
glob(pattern,flags)
glob — Find the file path that matches the pattern
Parameters 1: must . Specify search mode .
Parameters 2: Optional . Specify special settings . There is no more introduction here, because there is no .
If you want to achieve the effect, you can directly copy the following code :
<?php
namespace app\admin\controller;
use think\Cache;
class CacheController {
// Clear cache without deleting cache
public function clearCache() {
Cache::clear();
$this->success(" Clear successfully ");
}
// Clear the template cache without deleting temp Catalog ;
public function clearTemp() {
array_map('unlink',glob(TEMP_PATH.'*.php'));
$this->success(' Clear successfully ');
}
// Clear log cache and delete log Empty directory
public function clearLog() {
$path = glob(LOG_PATH . '*');
foreach ($path as $val) {
array_map('unlink', glob($val . DS . '*.log'));
rmdir($val);
}
$this->success(' Clear successfully ');
}
}
边栏推荐
- 20、 Processor scheduling (RR time slice rotation, mlfq multi-level feedback queue, CFS fully fair scheduler, priority reversal; multiprocessor scheduling)
- LeetCode: 377. Combined sum IV
- When should gridfs be used?
- Longest public prefix of leetcode
- 获取带参数的微信小程序二维码-以及修改二维码LOGO源码分享
- Endgame P.O.O
- 针对《VPP实现策略路由》的修正
- Niuke.com string deformation
- Zero foundation self-study SQL course | related sub query
- 如何管理海量的网络基础设施?
猜你喜欢

nVisual数字基础设施运营管理软件平台

About thinkphp5, use the model save() to update the data prompt method not exist:think\db\query- & gt; Error reporting solution

CDGA|到底怎么才能做好数据治理呢?

Oracle 12c升级至19c后ORA-28000错误

JCIM|药物发现中基于AI的蛋白质结构预测:影响和挑战

Zero foundation self-study SQL course | having clause

Handling method of Oracle data file header SCN inconsistency

深度学习论文阅读目标检测篇(七)中英对照版:YOLOv4《Optimal Speed and Accuracy of Object Detection》

grpc本地测试联调工具BloomRPC

Inspiration from reading CVPR 2022 target detection paper
随机推荐
转:三星电子CEO:一切决策都要从认清自己开始
20、 Processor scheduling (RR time slice rotation, mlfq multi-level feedback queue, CFS fully fair scheduler, priority reversal; multiprocessor scheduling)
Learning Tai Chi Maker - esp8226 (XIII) OTA
使用Live Chat促進業務銷售的驚人技巧
LeetCode: 137. 只出现一次的数字 II
ORA-16038 ORA-19502 ORA-00312故障处理
ApplicationContextInitializer的三种使用方法
医学图像开源数据集汇总(二)
198. house raiding
Vidéo courte recommandée chaque semaine: Soyez sérieux en parlant de "métaunivers"
An open source monitoring data collector that can monitor everything
实战剖析:app扫码登陆实现原理(app+网页端详细逻辑)附源码
ggplot2颜色设置总结
Thinkphp5 multi language switching project practice
CDGA|到底怎么才能做好数据治理呢?
NLP-D59-nlp比赛D28—我想,也好—阶段总结—心态调整
[custom endpoint and implementation principle]
threejs的 mmd模型加载+轮廓加载+动画加载+音频加载+相机动画加载+ammojs加载 gltf模型的加载 +gltf的反射调整
Codeforces Round #392 (Div. 2) D. Ability To Convert
Endgame P.O.O