Save tasks in JSON pretty print, and fixed todo.html addtask()
This commit is contained in:
parent
a701c2974c
commit
34e0f341ef
4 changed files with 34 additions and 5 deletions
|
@ -1,8 +1,9 @@
|
|||
<?php
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$data = json_decode(file_get_contents("php://input"), true);
|
||||
|
||||
var_dump($data);
|
||||
// Store tasks in a flat-file database (tasks.txt)
|
||||
file_put_contents("tasks.txt", implode("\n", $data["tasks"]));
|
||||
$ret = file_put_contents("tasks.json", json_encode($data["tasks"], JSON_PRETTY_PRINT));
|
||||
var_dump($ret);
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue