"; }?>]
减少遍历的范围是唯一优化的方法
使用 glob 不递归或目录迭代器可使速度提高,但也有限
$p = './';$res = glob("$p/*");for($i=0; $i $path = '.';$ite = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($path) );$deep = 0;foreach ($ite as $cur) { $fn = $cur->getBasename(); if($fn == '.' || $fn == '..') continue; $res[] = $fn; if(($d=$ite->getDepth()) == $deep); echo "$d $fn
";}
已抢65561个
抢已抢30196个
抢已抢16604个
抢已抢8439个
抢已抢10911个
抢已抢22254个
抢