PHPはディレクトリ下のすべてのファイルのコードを読みだします。


ディレクトリの下のすべてのファイルのコードを読み取り、ファイル名を問わず

<?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);  
   }  
}  
?>