读取目录下所有文件的代码,可以不管文件名
实现代码如下:

<?php  
$dir = "file";  

// Open a known directory, and proceed to read its contents  
if (is_dir($dir)) {  
   if ($dh = opendir($dir)) {  

       while (($file = readdir($dh)) !== false) {  
       if ($file!="." && $file!="..") {  
       echo "<a href=file/".$file.">".$file."</a><br>";  
       }  
       }  
       closedir($dh);  
   }  
}  
?> 

以上就是【PHP读取目录下所有文件的代码】的全部内容了,欢迎留言评论进行交流!

赞(0) 踩(0)

与本文相关的软件

发表我的评论

最新评论

  1. 暂无评论