0
我使用第三方API檢索業務信息。該物體看起來有點像這樣:獲取對象值
[businesses] => Array
(
[0] => stdClass Object
(
[name] => Business Name
[location] => stdClass Object
(
[city] => Dallas
[display_address] => Array
(
[0] => 123 Yellow Rd 620 N
要獲得企業名稱我做的:
$name = $response->businesses[0]->name;
我試圖讓城市和地址現在。
$name = $response->businesses[0]['location']->city;
似乎不工作......我錯過了什麼?
API是不是一種語言。 –