Revision: 62457
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 24, 2013 20:17 by apphp-snippets
Initial Code
<?php function list_directory_content($dir){ if(is_dir($dir)){ if($handle = opendir($dir)){ while(($file = readdir($handle)) !== false){ if($file != '.' && $file != '..' && $file != '.htaccess'){ echo '<a target="_new" href="'.$dir.$file.'">'.$file.'</a><br>'."\n"; } } closedir($handle); } } } ?>
Initial URL
http://www.apphp.com/index.php?snippet=php-list-directory-contents
Initial Description
This code allows to list the contents of any given directory.
Initial Title
List Directory Contents in PHP
Initial Tags
php, directory
Initial Language
PHP