Skip to content

Instantly share code, notes, and snippets.

@lukehedger
Created July 1, 2014 14:53
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 lukehedger/ff2ce941b5a2144566cc to your computer and use it in GitHub Desktop.
Save lukehedger/ff2ce941b5a2144566cc to your computer and use it in GitHub Desktop.
PHP directory scan
<?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