| changeset 295 | bcac9ea07d04 |
| parent 294 | d9247696a257 |
| child 296 | ded85569cb98 |
| 294:d9247696a257 | 295:bcac9ea07d04 |
|---|---|
1 <?php |
|
2 header('Content-Type: application/json; charset=utf-8'); |
|
3 $file = "example-cinema.json"; |
|
4 if (isset($_GET['reset']) && $_GET['reset']) { |
|
5 $resetfile = "test-data.json"; |
|
6 file_put_contents($file, file_get_contents($resetfile)); |
|
7 } |
|
8 if ($_SERVER['REQUEST_METHOD'] == 'PUT') { |
|
9 file_put_contents($file, file_get_contents("php://input")); |
|
10 echo json_encode(array("result" => "OK")); |
|
11 } else { |
|
12 echo file_get_contents($file); |
|
13 } |
|
14 ?> |