用shell脚本执行php删除缓存文件
<?php
#定义删除路径//服务器缓存目录的路径
$path = '/www/wwwroot/****/data/runtime';
#调用删除方法
deleteDir($path);
function deleteDir($dir)
{
if (!$handle = @opendir($dir)) {
return false;
}
while (false !== ($file = readdir($handle))) {
if ($file !== "." && $file !== "..") { //排除当前目录与父级目录
$file = $dir . '/' . $file;
if (is_dir($file)) {
deleteDir($file);
} else {
@unlink($file);
}
}
}
@rmdir($dir);
}
本文来自博客园,作者:小ྀ青ྀ年້,转载请注明原文链接:https://www.cnblogs.com/dalaowang/p/10898226.html

浙公网安备 33010602011771号