\n"; while($file = $dirOb->read()){ if($file == "." || $file == ".."){"/> \n"; while($file = $dirOb->read()){ if($file == "." || $file == ".."){">
<?php //直接遍历所有文件.递归 function trees($dirname){ $dirOb = dir($dirname); echo "<ul>\n"; while($file = $dirOb->read()){ if($file == "." || $file == ".."){ }else{ if(is_dir("$dirname/$file")){ echo "<li><font color=\"#ff00cc\"><b>$file</b></font></li>\n"; trees("$dirname/$file"); }else{ echo "<li>$file</li>\n"; } } echo "<br/>"; } echo "</ul>\n"; } trees("../tp5");
以上是递归直接遍历所有文件实例代码的详细内容。更多信息请关注PHP中文网其他相关文章!