Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [
- {
- "id": 1
- "nome": "José"
- },
- {
- "id": 2
- "nome": "João"
- }
- ]
- $path = explode('/', $_GET['path']);
- $contents = file_get_contents('tickets.json');
- $json = json_decode($contents, true);
- $method = $_SERVER['REQUEST_METHOD'];
- header('Content-type: application/json');
- $body = file_get_contents('php://input');
- if ($method === 'GET') {
- if ($json[$path[0]]) {
- echo json_encode($json[$path[0]]);
- }else{
- echo '[]';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement