gistfile1.txt function delDir( $directory ){ //递归删除文件夹下所有文件 if( file_exists( $directory ) ){ if( $dir_handle = @opendir( $directory ) ){ while ( $filename = readdir( $dir_handle ) ){ if($filename != '.' $filename!=".
function delDir( $directory ){ //递归删除文件夹下所有文件
if( file_exists( $directory ) ){
if( $dir_handle = @opendir( $directory ) ){
while ( $filename = readdir( $dir_handle ) ){
if($filename != '.' && $filename!=".."){
$subFile = $directory.'/'.$filename;
if(is_dir($subFile)){
delDir($subFile);
}
if(is_file($subFile)){
unlink($subFile);
}
}
}
}
closedir($dir_handle);
rmdir( $directory );
}
}
