<?php
//目录名
//$dirname = “D:\phpstudy_pro\WWW\www.php.com”;
//D:\phpstudy_pro\WWW\www.php.com\del
$dir = “D:\phpstudy_pro\WWW\www.php.com\del”;
$open = opendir($dir);
$file = readdir($open);
// while($file = readdir($open)){
// if($file != “.” and $file != “..”){
// echo $file.”<br>”;
// }
// }
function deldir($dirn){
if(file_exists($dirn)){
$open = opendir($dirn);
while($file=readdir($open)){
if($file != “.” and $file != “..”){
$filename = $dir.”/”.$file;
if(is_dir($filename)){
echo “删除目录”;
}
if(is_file($filename)){
echo “删除文件”;
}
echo $file.”<br>”;
}
}
}
}
deldir(“D:\phpstudy_pro\WWW\www.php.com\del”);