Skip to content

Instantly share code, notes, and snippets.

@pdbartsch
Created March 15, 2015 22:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pdbartsch/33dd7e20352e861eb3da to your computer and use it in GitHub Desktop.
Save pdbartsch/33dd7e20352e861eb3da to your computer and use it in GitHub Desktop.
List & link to contents of web directory PHP
<?php
$dir_open = opendir('.');
while(false !== ($filename = readdir($dir_open))){
if($filename != "." && $filename != ".."){
$link = "<a href='./$filename'> $filename </a><br />";
echo $link;
}
}
closedir($dir_open);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment