rmdirr($value);}$this->assign("jumpUrl"" />
文档库 最新最全的文档下载
当前位置:文档库 › thinkPHP删除缓存runtime.php

thinkPHP删除缓存runtime.php

public function del_cache() {
header("Content-type: text/html; charset=utf-8");
//清文件缓存
$dirs = array('./Runtime/');
@mkdir('Runtime',0777,true);
//清理缓存
foreach($dirs as $value) {
$this->rmdirr($value);
}
$this->assign("jumpUrl","__ROOT__/");
$this->success('系统缓存清除成功!');
//echo '

系统缓存清除成功!
';
}



/////////////下面是处理方法


public function rmdirr($dirname) {
if (!file_exists($dirname)) {
return false;
}
if (is_file($dirname) || is_link($dirname)) {
return unlink($dirname);
}
$dir = dir($dirname);
if($dir){
while (false !== $entry = $dir->read()) {
if ($entry == '.' || $entry == '..') {
continue;
}
//递归
$this->rmdirr($dirname . DIRECTORY_SEPARATOR . $entry);
}
}
$dir->close();
return rmdir($dirname);
}


相关文档