我制作了一个简单的 facebook 注册小部件。
在注册时,应用程序将数据发送到 send.php
在 send.php 我有
print_r($response);
我得到这样的东西:
Array
(
[algorithm] => HMAC-SHA256
[expires] => 1367953200
[issued_at] => 1367946138
[oauth_token] => BAAE0refKufgBAORkK7hUaVpF8MnFygoqHAHrO3nRJMyNjvJx6RjiMjoqbz2YlfqeogcIPGJJaIgD0xtxhBj1WRgQ5F5SidjwM7ZCKOyZBlEuatIqIccbjGj2uMV5hqtKtZA1g7hOEqMeZAEwmnO6SgRgsb9ittKZCDnPfoxYxCxZAZBAhIKX457IG5ZB4yknv9FZB8QUG7Pt0mfBRQUYG12KoTmO7QRH20LP65FyPqTi7mAZDZD
[registration] => Array
(
[name] => derp derp
[email] => ddddd@gmail.com
[location] => Array
(
[name] => Vienna, Austria
[id] => 1.1116511224109E+14
)
[gender] => male
[phone] => sss
)
[registration_metadata] => Array
(
[fields] => [ {'name':'name'}, {'name':'email'}, {'name':'location'}, {'name':'gender'}, {'name':'phone', 'description':'Phone Number', 'type':'text'},]
)
[user] => Array
(
[country] => at
[locale] => en_US
)
[user_id] => 100000506481284
)
所以数据可以毫无问题地传递,但我怎样才能访问一个特定的值呢?
例如教科书数组的东西似乎不像:
print $response[0];
给我一个错误:
Notice: Undefined offset: 0 in C:\xampp\htdocs\ddd\send.php on line 38
我还能如何访问数据?
例如,我如何将国家、电子邮件、姓名或其他任何内容存储在他们自己的变量中,以便我以后可以回显它们?它在那里,但我似乎无法弄清楚如何用 php 正确“消化”它。