更新
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* 清除ThinkPHP缓存脚本
|
||||
* 在浏览器中访问此文件来清除缓存
|
||||
*/
|
||||
|
||||
// 设置缓存目录
|
||||
$cacheDir = __DIR__ . '/server/runtime/cache';
|
||||
|
||||
// 递归删除目录
|
||||
function deleteDir($dir) {
|
||||
if (!is_dir($dir)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$files = array_diff(scandir($dir), ['.', '..']);
|
||||
foreach ($files as $file) {
|
||||
$path = $dir . '/' . $file;
|
||||
is_dir($path) ? deleteDir($path) : unlink($path);
|
||||
}
|
||||
|
||||
return rmdir($dir);
|
||||
}
|
||||
|
||||
// 清除缓存
|
||||
if (is_dir($cacheDir)) {
|
||||
$files = array_diff(scandir($cacheDir), ['.', '..']);
|
||||
foreach ($files as $file) {
|
||||
$path = $cacheDir . '/' . $file;
|
||||
if (is_dir($path)) {
|
||||
deleteDir($path);
|
||||
} else {
|
||||
unlink($path);
|
||||
}
|
||||
}
|
||||
echo "缓存已清除!<br>";
|
||||
echo "请刷新页面重试。";
|
||||
} else {
|
||||
echo "缓存目录不存在:" . $cacheDir;
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user