publicfunctiondelDir(){$dirName=$_SERVER['DOCUMENT_ROOT'].'/目录';$this->delDirAndFile($dirName);}functiondelDirAndFile($dirName){if($handle=opendir($dirName)){while(false!==($item=readdir($handle))){if($item!="."&&$item!=".."){if(is_dir("$dirName/$item")){$this->delDirAndFile("$dirName/$item");}else{unlink("$dirName/$item");}}}closedir($handle);rmdir($dirName);}}