当前位置 : 主页 > 网络编程 > PHP >

PHP解析 JSON 数据

来源:互联网 收集:自由互联 发布时间:2021-06-30
$json_string='{"id":1,"name":"rolf","country":"russia","office":["google","oracle"]} ';$obj=json_decode($json_string);//print the parsed dataecho $obj-name; //displays rolfecho $obj-office[0]; //displays google
$json_string='{"id":1,"name":"rolf","country":"russia","office":["google","oracle"]} ';
$obj=json_decode($json_string);
//print the parsed data
echo $obj->name; //displays rolf
echo $obj->office[0]; //displays google
网友评论