Created
December 24, 2015 02:26
-
-
Save mrofi/1b43dc1ebaceaad7d42d to your computer and use it in GitHub Desktop.
index.php to list all files in directory. just like apache did but it can be done in php built in server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dir = __DIR__; // Directory where files are stored | |
if ($dir_list = opendir($dir)) | |
{ | |
while($files[] = readdir($dir_list)); | |
sort($files); | |
closedir($dir_list); | |
foreach ($files as $file) | |
{ | |
echo '<p><a href="'.$file.'">'.$file.'</a></p>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment