当前位置: 移动技术网 > IT编程>开发语言>PHP > 一个目录遍历函数

一个目录遍历函数

2019年05月22日  | 移动技术网IT编程  | 我要评论
一个目录遍历函数 <?phpfunction dirtree($path="./

一个目录遍历函数 <?php

function dirtree($path="./test") {
  echo "<dl>";
  $d = dir($path);
  while(false !== ($v = $d->read())) {
    if($v == "."
$v == "..")
      continue;
    $file = $d->path."/".$v;
    echo "<dt>$v";
    if(is_dir($file))
      dirtree($file);
  }
  $d->close();
  echo "</dl>";
}

dirtree();
?>

如您对本文有疑问或者有任何想说的,请 点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网