Return to Snippet

Revision: 42881
at March 11, 2011 22:55 by xhiena


Initial Code
<?php
//folder you want to list
$path=".";
//extension you don't want to list
$no_mostrar=Array("","php");

$dir_handle = @opendir($path) or die("Error Opening $path");
while ($file = readdir($dir_handle)) {
 $pos=strrpos($file,".");
 $extension=substr($file,$pos);
 if (!in_array($extension, $no_mostrar)) {
 echo "<a href=\"$file\" id=\"enlace_$file\" title=\"$file\">$file</a><br />";
 }
 
}
closedir($dir_handle);
?>

Initial URL
http://xhiena.net/index/php-mostrar-contenido-directorio/

Initial Description

                                

Initial Title
List folder content

Initial Tags
list

Initial Language
PHP