看了bbcash的“[1.5.4]缓存与清除缓存”
http://codeigniter.org.cn/forums/thread-286-1-1.html
在网上搜了点代码,清空
文件夹
这下可省事了。:lol
(我看不懂的,能用就好了)
复制内容到剪贴板PHP 代码:
function clearall
() {//删除目录 $echo =
'';
$result =
false;
$path =
$this->
config->
item('cache_path');
$dirName =
($path ==
'') ? BASEPATH.
'cache/' :
$path;
if(!
is_dir($dirName)) { trigger_error('Invalid Parameter',
E_USER_ERROR);
} $handle =
opendir($dirName);
while(($file =
readdir($handle)) !==
false) { if($file !=
'.' &&
$file !=
'..' &&
$file !=
'index.html') //这里留着那个空的index.html了 { $dir =
$dirName . DIRECTORY_SEPARATOR .
$file;
$echo .=
$file.
'<br>';
is_dir($dir) ?
$this->
removeDir($dir) :
unlink($dir);
} } closedir($handle);
return $echo;
}