Save tasks in JSON pretty print, and fixed todo.html addtask()

This commit is contained in:
Lutchy Horace 2024-01-29 07:36:56 -05:00
parent a701c2974c
commit 34e0f341ef
4 changed files with 34 additions and 5 deletions

View file

@ -1,5 +1,5 @@
<?php
// Load tasks from the flat-file database (tasks.txt)
$tasks = file_exists("tasks.txt") ? explode("\n", file_get_contents("tasks.txt")) : [];
// Load tasks from the flat-file database (tasks.json)
$tasks = file_exists("tasks.json") ? json_decode(file_get_contents("tasks.json")) : [];
echo json_encode($tasks);
?>