isDir() && !$fileinfo->isDot()) { try{ $fileContent = file_get_contents('./'.$fileinfo->getFilename().'/readme.txt'); $date = filemtime('./'.$fileinfo->getFilename().'/readme.txt'); }catch(Exception $e){ $fileContent = null; } $arr = explode("\n", $fileContent); array_push($object, array('name' => $fileinfo->getFilename(),'category'=>$arr[0],'title'=>$arr[1],'description'=>$arr[2],'date'=>$date)); } } echo json_encode($object); ?>