Created
April 17, 2017 17:19
-
-
Save timbophillips/2958484ffa57e6f4cdd39acce231caea to your computer and use it in GitHub Desktop.
simpler php script to return file list as JSON - no option for extension
This file contains 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 | |
/* | |
call this with GET | |
returns JSON of files in folder | |
optional arguments: | |
folder (defaults to current folder) | |
*/ | |
if (isset($_GET['folder'])) { | |
$folder = $_GET['folder']; | |
} | |
else { | |
$folder = './'; | |
} | |
echo json_encode(array_slice(scandir($folder),2)); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment