当我向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
vid-offset: (integer) 111259
当我$response->contacts
我得到所有联系人时,没有问题,但这vid-offset
的名称中有一个-
,所以这不起作用:
$response->vid-offset
我也试过这个:
$response['vid-offset'];
我收到此错误:Cannot use object of type stdClass as array
我也尝试过做:
$response->getAttribute('vid-offset')
但它仍然没有奏效。
如何获取vid-offset
房产的价值?
你可以这样得到它:
$response->{'vid-offset'};