标签:
<?php function del_DirAndFile($dirName){ if(is_dir($dirName)){ echo "<br /> "; if ( $handle = opendir( "$dirName" ) ) { while ( false !== ( $item = readdir( $handle ) ) ) { if ( $item != "." && $item != ".." ) { if ( is_dir( "$dirName/$item" ) ) { del_DirAndFile( "$dirName/$item" ); } else { if( unlink( "$dirName/$item" ) )echo "已删除文件: $dirName/$item<br /> "; } } } closedir( $handle ); if( rmdir( $dirName ) ) echo "已删除目录: $dirName<br /> "; } } } ?> <?php del_DirAndFile(‘test/‘); ?>
标签:
原文地址:http://www.cnblogs.com/xinlinux/p/4264721.html