我在Laravel向Guzzle提出了请求,并收到了这样的回复:
{
"ErrorCode": 0,
"ErrorDescription": "Success.",
"Data": [
{
"brand_id": 1,
"tenant_id": "tn001",
"brand_name": "ABC",
"brand_url": "url.com",
"brand_avatar": "avatar.com",
"brand_banner": "banner.com",
"brand_about": "abc."
}
]
}
我如何访问brand_name字段?
谢谢!
答案 0 :(得分:0)
$response = json_decode($guzzleResponse,true);
echo $response['Data'][0]['brand_name'];
您只需要解码json ton数组并照常解析即可。
只需注意Data
内的嵌套数组即可。