【发布时间】:2017-11-24 22:29:41
【问题描述】:
我有以下 json :-
{
"firstName": "Jhon",
"lastName": "Doe",
"username": "jhon",
"avatar": "localhost/uploads/avatars/default.jpg",
"language": "ar",
"birth_date": "2017-11-22 00:00:00",
"weight_chart": [],
"health_status": {
"id": 130,
"user_id": 258,
"weight": 95,
"height": 171,
},
上面的json我解码了
$user = json_decode($response);
现在我可以使用以下方法打印名字: $user->名字
我的问题是:-
- 我可以在不解码的情况下访问 json 值吗?
- 如何访问“health_status”值 id、体重...?
【问题讨论】:
标签: php arrays json multidimensional-array