Created
July 1, 2014 14:53
-
-
Save lukehedger/ff2ce941b5a2144566cc to your computer and use it in GitHub Desktop.
PHP directory scan
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 | |
header('Content-Type: application/json'); | |
function scan(){ | |
$dirOne = scandir('../data/one'); | |
$dirTwo = scandir('../data/two'); | |
$response = (object) array('dirOne' => $dirOne, 'dirTwo' => $dirTwo); | |
return $response; | |
} | |
echo json_encode(scan()); | |
// Load script via AJAX, an array of files/folders in each directory will be returned for processing | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment