当前位置:网站首页>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 ');
}
}
边栏推荐
- How to locate lock waiting in Dameng database
- Thinkphp5清除runtime下的cache缓存,temp缓存,log缓存
- impdp导schema报ORA-31625异常处理
- Idea cannot save settings source root d:xxxx is duplicated in module XXX
- Vidéo courte recommandée chaque semaine: Soyez sérieux en parlant de "métaunivers"
- 【自定义Endpoint 及实现原理】
- 从618看京东即时零售的野心
- Oracle database expdp only exports tables
- 如何让社交媒体成为跨境电商驱动力?这款独立站工具不能错过!
- Grpc local test joint debugging tool bloomrpc
猜你喜欢

零基础自学SQL课程 | HAVING子句

文献调研报告

CF566E-Restoring Map【bitset】

Servlet快速筑基

Prct-1400: failed to execute getcrshome resolution

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

Five heart matchmaker

Learn Tai Chi Maker - esp8226 (12) esp8266 multitasking

Inspiration from reading CVPR 2022 target detection paper

Cdga | how can we do well in data governance?
随机推荐
threejs的点光源+环境光
PHP使用递归和非递归方式实现创建多级文件夹
impdp导schema报ORA-31625异常处理
PTA猴子选大王(约瑟夫环问题)
linux下oracle服务器打开允许远程连接
Oracle数据文件头SCN不一致处理方法
零基础自学SQL课程 | 子查询
如何提高网络基础设施排障效率,告别数据断档?
WindowManager 简单悬浮框的实现
桌面软件开发框架大赏
零基础自学SQL课程 | 相关子查询
使用Live Chat促進業務銷售的驚人技巧
Ggplot2 color setting summary
Why is LNX of e equal to X
Implementation of simple floating frame in WindowManager
Thinkphp5 multi language switching project practice
PhpStrom代码格式化设置
L01_ How is an SQL query executed?
Codeforces Round #392 (Div. 2) D. Ability To Convert
关于thinkphp5 使用模型save()更新数据提示 method not exist:think\db\Query-&gt; 报错解决方案