PHP解析json数据(历史恢复文章)

发布于 2023-03-10  192 次阅读


该文章恢复至 2021年01月19日 的文章

json数据:$json = '{"state": "1","test": "2"}';

json解析:$de_json = json_decode(【json数据】,true);

输出json内的数据:echo $de_json['state'];//输出结果为 1

解析例子:

$json = '{"state": "1","test": "2"}';
$de_json = json_decode($json,true);
echo $de_json['state']; //输出state内的数据,输出结果为1
echo $de_json['test']; //输出test内的数据,输出结果为2
最后更新于 2023-03-10