Listing the Contents of a Directory with readdir() : Directory : File Directory PHP Source Code


PHP Source Code » File Directory » Directory »

 

Listing the Contents of a Directory with readdir()




<html>
<head>
<title>Listing the contents of a directory with readdir()</title>
</head>
<body>
<?php
$dirname = "./";
$dh = opendir$dirname );
while gettype$file = readdir$dh )) != boolean ){
   if is_dir"$dirname/$file" ) )
       print "(D)";
   print "$file<br>";
}
closedir$dh );
?>
 </body>
</html>

           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo File Directory
» Directory