Sorry if my question is basic, because I dont familiar with php and json. I have create a php file that list a directory on my server and should print the result as JSON. So, how can I do that?
Here is my code to list files on directory:
<?php
$dir = "picture/";
if(is_dir($dir)){
if($dh = opendir($dir)){
while(($file = readdir($dh)) != false){
if($file == "." or $file == ".."){
} else {
echo $file."<br />";
//echo json_encode($file);
}
}
}
}
?>
Thank you for your response....