一个目录遍历函数
一个目录遍历函数
发布时间:2016-12-29 来源:查字典编辑
摘要:一个目录遍历函数

一个目录遍历函数 <?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();

?>

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新php教程学习
热门php教程学习
编程开发子分类