public function dir_file(){ $dir = APP_PATH.'Runtime/'; $this->rm_deldir($dir); //D:/phpStudy/WWW/System/Runtime/ } public function rm_deldir($dir){ header('Content-type:text/html;charset=utf-8'); $dh = opendir($dir); //打开目录 while($file = readdir($dh)){ //print_r($file.'</br>'); // . .. Data Logs Temp .根目录 ..上级目录 if($file !="." && $file !=".."){ $fillpath = $dir.$file; //D:/phpStudy/WWW/System/Runtime/Data if(!is_dir($fillpath)){ @unlink($fillpath); echo ' 缓存文件_('.$file.')已删除<br />'; }else{ $this->rm_deldir($fillpath.'/');//D:/phpStudy/WWW/System/Runtime/Data/ 下的文件 } } } }