当前位置:Gxlcms > PHP教程 > 写了个遍历目录的方法_PHP教程

写了个遍历目录的方法_PHP教程

时间:2021-07-01 10:21:17 帮助过:22人阅读

function traversal($dirname)
{

$dir = dirname($dirname);
if(!is_dir($dirname)){
die(Bad path please retry!!!);
return ;
}

$handle = opendir($dirname);

while(($file=readdir($handle))!==false ){
if($file != . && $file!=..){
echo "
" ;
echo $indir = $dirname . / . $file ;
if(is_dir($indir)){
allsee($indir);
}
}

}
closedir($handle);
}

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/486326.htmlTechArticlefunction traversal($dirname) { $dir = dirname($dirname); if(!is_dir($dirname)){ die(Bad path please retry!!!); return ; } $handle = opendir($dirname); while(($file=readdir($handle)...

人气教程排行