将我的 JSON 解码为数组并在其上使用print_r后,我看到以下输出:
Array
(
[users] => Array
(
[0] => Array
(
[id] => 197849982
[url] => https://somewhere.zendesk.com/api/v2/users/197849982.json
[name] => Some User
[created_at] => 2012-04-15T00:38:33Z
[updated_at] => 2012-06-08T07:53:03Z
[time_zone] => Sydney
[email] => email@email.com
[phone] =>
[photo] =>
[locale_id] => 1
[locale] => en-US
[organization_id] => 21520772
[role] => admin
[verified] => 1
[external_id] =>
[tags] => Array
(
)
[alias] =>
[active] => 1
[shared] =>
[shared_agent] =>
有更多的输出,但我已经截断了它。
我需要访问诸如“id”和“name”之类的值并将它们放入变量中,但我不知道如何在该数组中获取它们。我尝试了几种方法,每次都得到不同的错误。
如何访问此数组中的数据?