php递归删除目录所有文件
发布:smiling 来源: PHP粉丝网 添加日期:2014-08-15 15:44:54 浏览: 评论:
- <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{
- $a = explode('.',$file);
- if($a[1] == 'html' || $a[1] == 'htm')
- {
-
- echo "<li>$file</li> ";
- }
-
-
- }
- }
- echo "</ul> ";
- $mydir->close();
- }
-
-
- echo "<h2>目录为粉红色</h2><br> ";
- tree("./");
- ?>
分享到: