<?
function dir_all ( $path )
{             $handler = opendir($path);
         
             while (false!==($tmp = readdir($handler)))
             {                if(is_dir( "$path/$tmp" ))
                {
                      if ($tmp=="." || $tmp=="..")
                      continue;
                      echo $tmp."<br>\n";
                      dir_all ("$path/$tmp");
                                      }                else 
                {
                      echo $tmp ."<br>\n";
                }              }
}?>

解决方案 »

  1.   

    <?php
    function dir_all ( $path ) {
         
           if ($handle = @opendir($dir)) {
                  while(false !== ($file = @readdir($handle))) {
                        if (@filetype($dir.$file) == "file") {
                                  echo $file."<br>\n";
                       } else {
                          if ($file=="." || $file=="..")
                          continue;
                          echo $file."<br>\n";
                          dir_all ("$path/$file);
                       }
            }
    }
    ?>