我正在用Guzzle和Laravel5.4创建应用程序。在这里,我对外部API进行请求,它给出了如下响应。
{
"scope": "PRODUCTION",
"token_type": "bearer",
"expires_in": 3600,
"refresh_token": "",
"access_token": ""
}
我需要访问这个响应的access_token
属性。如何在GuzzleHttp中访问这些。响应内容类型在application/json
中
发布于 2018-08-30 14:39:44
我用这个方法解决了,
$array = $response->getBody()->getContents();
$json = json_decode($array, true);
$collection = collect($json);
$access = $collection->get('access_token');
https://stackoverflow.com/questions/52092378
复制相似问题