thinkphp 2.1清除缓存文件夹代码
时间:2011-11-18
来源:互联网
/**
* 删除系统缓存
*/
function clearCache()
{
import("ORG.Io.Dir");
Dir::del(APP_PATH."/Runtime/");
Dir::del(APP_PATH."/Runtime/Cache/");
return 'succ';
}
//清除缓存文件夹
function deldir($dir) {
//先删除目录下的文件:
$dh=opendir($dir);
while ($file=readdir($dh)) {
if($file!="." && $file!="..") {
$fullpath=$dir."/".$file;
if(!is_dir($fullpath)) {
unlink($fullpath);
} else {
deldir($fullpath);
}
}
}
closedir($dh);
//删除当前文件夹:
if(rmdir($dir)) {
return true;
} else {
return false;
}
}
CacheAction.class.php代码如下
//清除缓存
public function cache() {
deldir('admin/Runtime');
$this->assign('waitSecond', 10);
$this->success('缓存清理完毕!请刷新后台或者从新登陆!');
$say= "清理缓存文件夹成功! "."</br>";
$this->success($say);
}
* 删除系统缓存
*/
function clearCache()
{
import("ORG.Io.Dir");
Dir::del(APP_PATH."/Runtime/");
Dir::del(APP_PATH."/Runtime/Cache/");
return 'succ';
}
//清除缓存文件夹
function deldir($dir) {
//先删除目录下的文件:
$dh=opendir($dir);
while ($file=readdir($dh)) {
if($file!="." && $file!="..") {
$fullpath=$dir."/".$file;
if(!is_dir($fullpath)) {
unlink($fullpath);
} else {
deldir($fullpath);
}
}
}
closedir($dh);
//删除当前文件夹:
if(rmdir($dir)) {
return true;
} else {
return false;
}
}
CacheAction.class.php代码如下
//清除缓存
public function cache() {
deldir('admin/Runtime');
$this->assign('waitSecond', 10);
$this->success('缓存清理完毕!请刷新后台或者从新登陆!');
$say= "清理缓存文件夹成功! "."</br>";
$this->success($say);
}
作者: dengwei1999 发布时间: 2011-11-18
写在哪?怎么用?我是新手,现在因为缓存不会清除,导致有些字段写不进去值。
作者: XX0604 发布时间: 2011-12-01
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28