Php Guzzle是否从带有破折号的属性中获取值?
当我大口大口地提出请求时:Php Guzzle是否从带有破折号的属性中获取值?,php,guzzle,Php,Guzzle,当我大口大口地提出请求时: $response = json_decode($client->get($uri)->getBody()->getContents()); var_dump($response); die; 我在var_dump中得到这个: stdClass (object) [Object ID #2395][3 properties] contacts: (array) [250 elements] has-more: (boolean) true v
$response = json_decode($client->get($uri)->getBody()->getContents());
var_dump($response); die;
我在var_dump中得到这个:
stdClass (object) [Object ID #2395][3 properties]
contacts:
(array) [250 elements]
has-more: (boolean) true
vid-offset: (integer) 111259
当我生成$response->contacts时,我会得到所有联系人,这没有问题,但是这个vid偏移量的名称中有一个-,所以这不起作用:
$response->vid-offset
我也试过:
$response['vid-offset'];
我得到一个错误:不能使用stdClass类型的对象作为数组
我也尝试过这样做:
$response->getAttribute('vid-offset')
但它仍然不起作用
如何获取vid offset属性的值?您可以通过以下方式获取:
$response->{'vid-offset'};
您可以通过以下方式获得:
$response->{'vid-offset'};