php递归删除目录所有文件
<meta http-equiv= "content-type" content= "text/html; charset=gb2312" > <?php function tree( $directory ) { $mydir =dir( $directory ); echo "<ul> " ; while ( $file = $mydir ->read()){ if (( is_dir ( "$directory/$file" )) and ( $file != "." ) and ( $file != ".." )) { echo "<li><font color=" #ff00cc "><b>$file</b></font></li> " ; tree( "$directory/$file" ); } else { //开源代码phpfensi.com $a = explode ( '.' , $file ); if ( $a [1] == 'html' || $a [1] == 'htm' ) { //unlink($file); echo "<li>$file</li> " ; } } } echo "</ul> " ; $mydir ->close(); } //开始运行 echo "<h2>目录为粉红色</h2><br> " ; tree( "./" ); ?>查看更多关于php递归删除目录所有文件 - php文件操作的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did27792