您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php操作json的方法

2024/6/6 13:46:34发布26次查看
这次给大家带来php操作json的方法,php操作json的注意事项有哪些,下面就是实战案例,一起来看一下。
实例如下所示:
// 追加写入用户名下文件 $code=001;//动态数据     $json_string = file_get_contents(text.json);// 从文件中读取数据到php变量     $data = json_decode($json_string,true);// 把json字符串转成php数组     $data[$code]=array(a=>as,b=>bs,c=>cs);     $json_strings = json_encode($data);     file_put_contents(text.json,$json_strings);//写入 //修改  $json_string = file_get_contents(text.json);// 从文件中读取数据到php变量     $data = json_decode($json_string,true);// 把json字符串转成php数组     $data[001][a]=aas;     $json_strings = json_encode($data);     file_put_contents(text.json,$json_strings);//写入
相信看了本文案例你已经掌握了方法,更多精彩请关注其它相关文章!
推荐阅读:
强制下载二维码图片
php的递归函数该如何使用
以上就是php操作json的方法的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product