时间:2021-07-01 10:21:17 帮助过:26人阅读
1、清除PHP缓存文件
<?php function read_dir($dir,$file) { $a =strpos($file,".php"); if($a>0) { unlink($dir . $file); echo "delete $dir$file <br>"; return true; } if(strpos($file,".") === 0 || strpos($file,".") !== false ) return true; if(strpos($file,".") === false || strpos($dir,"/") === false) { $dir = $dir . $file . "/"; if(!is_dir($dir)) return false; $dh = opendir($dir); while(($file = readdir($dh)) != false) { read_dir($dir,$file); //递归调用 } } } function clear_caches() { $dir = "./temp/"; //要清除的PHP缓存文件目录 if(!is_dir($dir)) die("It is not a dir"); $dh = opendir($dir); while(($file = readdir($dh) )!=false) { //var_dump($file); read_dir($dir,$file); } } ?>