Home > php教程 > php手册 > 一个目录遍历函数

一个目录遍历函数

WBOY
Release: 2016-06-13 12:45:04
Original
1066 people have browsed it


一个目录遍历函数
function dirtree($path="./test") {
  echo "

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

dirtree();
?>
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template