<?php $jsonOr=file_get_contents("json.json"); $jsonDe=json_decode($jsonOr); array_push($jsonDe,array($_POST["title"],$_POST["content"])); $jsonEn=json_encode($jsonDe); file_put_contents($jsonOr,$jsonEn;); ?>
<?php $jsonOr=file_get_contents("json.json"); $jsonDe=json_decode($jsonOr); array_push($jsonDe,array($_POST["title"],$_POST["content"])); $jsonEn=json_encode($jsonDe); file_put_contents($jsonOr,$jsonEn;); ?>
file_put_contents($jsonor,$jsonen;); ????
先搞清楚这个函数每个参数的意义,检查一下文件写入权限,再把语法错误修改一下好伐~
$jsonDe=json_decode($jsonOr);
建议加第二个参数,默认的话,decode出来的东西是对象,而不是数组。
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号