当前位置:首页> PHP教程> php基础
关键字
文章内容
一个目录遍历函数
 
 
修改时间:[2008/08/10 17:55]    阅读次数:[799]    发表者:[起缘]
 
一个目录遍历函数
<?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();
?>