| author | ymh <ymh.work@gmail.com> |
| Fri, 16 May 2014 14:14:39 +0200 | |
| changeset 294 | d9247696a257 |
| parent 248 | cdfa6479982b |
| permissions | -rw-r--r-- |
| 4 | 1 |
<?php |
2 |
header('Content-Type: application/json; charset=utf-8'); |
|
| 248 | 3 |
$file = "example-cinema.json"; |
| 4 | 4 |
if (isset($_GET['reset']) && $_GET['reset']) { |
5 |
$resetfile = "test-data.json"; |
|
6 |
file_put_contents($file, file_get_contents($resetfile)); |
|
7 |
} |
|
| 18 | 8 |
if ($_SERVER['REQUEST_METHOD'] == 'PUT') { |
9 |
file_put_contents($file, file_get_contents("php://input")); |
|
| 4 | 10 |
echo json_encode(array("result" => "OK")); |
11 |
} else { |
|
12 |
echo file_get_contents($file); |
|
13 |
} |
|
14 |
?> |