一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

php递归删除目录所有文件

时间:2010-10-09 编辑:简简单单 来源:一聚教程网

function tree($directory)
{
$mydir=dir($directory);
echo "

    ";
    while($file=$mydir->read()){
    if((is_dir("$directory/$file")) and ($file!=".") and ($file!=".."))
    {echo "
  • $file
  • ";
    tree("$directory/$file");
    }
    else{
        $a = explode('.',$file);
        if($a[1] == 'html' || $a[1] == 'htm')
       {
            //unlink($file);
                echo "
  • $file
  • ";
            }   
       

    }
    }
    echo "

";
$mydir->close();
}
//开始运行

echo "

目录为粉红色


";
tree("./");
?>

热门栏目