Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {"data":["file1.txt","file2.txt","file3.txt"]}
- public function getDirectories() {
- $dir = $this->getConfig(); // My Directory
- $array = array();
- $handle = opendir($dir);
- while (FALSE !== ($entry = readdir($handle))) {
- if ($entry == '.' || $entry == '..')
- continue;
- $array[] = $entry;
- }
- return $array;
- }
- class ArrayValue implements JsonSerializable {
- public function __construct(array $array) {
- $this->array = $array;
- }
- public function jsonSerialize() {
- return array('data' => $this->array);
- }
- }
- {"data":{"file1.txt","file2.txt","file3.txt"}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement