We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 223ccb3 commit 76552e3Copy full SHA for 76552e3
server.php
@@ -19,12 +19,12 @@ function routeRequest()
19
case '/comments.json':
20
if($_SERVER['REQUEST_METHOD'] === 'POST') {
21
$commentsDecoded = json_decode($comments, true);
22
- $commentsDecoded[] = ['author' => $_POST['author'],
+ $commentsDecoded[] = ['author' => $_POST['author'],
23
'text' => $_POST['text']];
24
25
$comments = json_encode($commentsDecoded);
26
file_put_contents('_comments.json', $comments);
27
- }
+ }
28
header('Content-Type: application/json');
29
echo $comments;
30
break;
0 commit comments