【发布时间】:2021-12-23 20:04:14
【问题描述】:
我有这个 JSON 数组数据
{"accessToken":"eyJhbGciOiJSUzUxMiJ9.e","refreshToken":"QErx0bUxyx6wxFj5AXcAh21UuyO8ad/ULIaGlP3LU2lmXGnx0twbYdM+nJyfwAcK9Av50uZ3fSZ/2nhJwIi+bA==","expiresIn":"2021-11-11T10:20:33Z","issuedAt":"2021-11-11T10:05:33Z","tokenType":"Bearer"}
如何从数组中仅获取 accessToken 对象。即yJhbGciOiJSUzUxMiJ9.e
这就是我尝试过的方法
$response = curl_exec($curl);
curl_close($curl);
$token = $response['accessToken'];
echo $token;
但我得到了这个错误
Warning: Illegal string offset 'accessToken'
【问题讨论】: