Created
July 10, 2018 00:01
-
-
Save guibranco/2ada0af85e3140206f0a1a87e0fb30c1 to your computer and use it in GitHub Desktop.
Script para listar arquivos em um diretório e retornar os dados no formato JSON - Facebook - PHP Brasil - https://www.facebook.com/groups/142151625841770/permalink/1850978598292389/
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 | |
$dir = "./images/"; | |
if (!($handle = opendir($dir))) | |
die("Unable to open the directory $dir"); | |
$registros = array(); | |
while (false !== ($file = readdir($handle))) { | |
if ($file === "." or $file === "..") | |
continue; | |
array_push($registros, array("IMAGE" => $file)); | |
} | |
closedir($handle); | |
echo json_encode($registros); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment