$_POST['日期'], '哪一餐'=> $_POST['哪一餐'], '吃什麼'=> $_POST['吃什麼'], '金額'=> $_POST['金額'], ); $array_data[] = $extra; $final_data = json_encode($array_data); file_put_contents("test.json", $final_data); header("Refresh:0"); } $json_file = file_get_contents("test.json"); $data = json_decode($json_file, true); $sum = 0; echo "
".'日期'." | "; echo "".'哪一餐'." | "; echo "".'吃什麼'." | "; echo "".'金額'." | "; echo "
".$row['日期']." | "; echo "".$row['哪一餐']." | "; echo "".$row['吃什麼']." | "; echo "".$row['金額']." | "; echo "
總計金額:$sum
"; ?>