parent
cf958c67e4
commit
7adff9649a
@ -1,3 +1,5 @@
|
|||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
RewriteCond %{REQUEST_METHOD} ^DELETE$
|
RewriteCond %{REQUEST_METHOD} ^DELETE$
|
||||||
RewriteRule ^([0-9]+)$ delete.php?id=$1
|
RewriteRule ^([0-9]+)$ delete.php?id=$1
|
||||||
|
RewriteCond %{REQUEST_METHOD} ^POST$
|
||||||
|
RewriteRule ^$ post.php
|
||||||
|
|||||||
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
include 'data/people.php';
|
||||||
|
|
||||||
|
$requestBody = file_get_contents('php://input');
|
||||||
|
$body = json_decode($requestBody);
|
||||||
|
$zagthar = new Person($body->name, $body->age);
|
||||||
|
|
||||||
|
$people[] = $zagthar;
|
||||||
|
|
||||||
|
echo json_encode($people);
|
||||||
|
?>
|
||||||
Loading…
Reference in new issue