function file_list($path)  
{  
    if ($handle = @opendir($path))//打开路径成功  
    {  
        while (false !== ($file = readdir($handle)))//循环读取目录中的文件名并赋值给$file  
        {  
            if ($file != "." && $file != "..")//排除当前路径和前一路径  
            {  
                if (is_dir($path."/".$file))  
                {  
                    file_list($path."/".$file);  
                }  
                else  
                {  
                    echo $path.": ".$file."<br>"; 
                }  
            } 
        } 
    }
    //closedir($handle);  
}
file_list($path);

  

相关文章:

  • 2022-01-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-10
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
猜你喜欢
  • 2021-11-21
  • 2021-12-05
  • 2021-04-15
  • 2022-12-23
  • 2021-12-18
  • 2021-05-16
  • 2021-12-31
相关资源
相似解决方案