<?php
function recursive($dir) {
  $handle = opendir($dir);
  echo "<ul>";
  while($line = readdir($handle)){
    if($line == '.' || $line == '..') continue;
    echo  "<li>".iconv('gbk','utf-8',$line)."</li>";
    if(is_dir("$dir/$line")){
      recursive("$dir/$line");
    }
  }
  echo "</ul>";
  closedir($handle);
}
recursive("./")
?>

发表评论

Close Menu