一個目錄遍歷函數
<?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();
?>