PHP Facebook 应用程序 JSON 问题
我正在开发一个 Facebook 应用程序,我需要在其中查看个人资料的 user_work_history 数据。我用 PHP 来做这件事,而 Facebook 的文档非常神秘和糟糕。
在文档(http://developers.facebook.com/docs/reference/api/user/)中,它说“包含雇主、位置、职位、开始日期和结束日期字段的 JSON 对象数组”。我假设我可以通过执行 但是,它只在输出中返回“array”。
我尝试过各种方法,例如 这也不起作用。
任何帮助将不胜感激和认可!
I am developing a Facebook Application in which I need to view the user_work_history data of a profile. Im doing this in PHP, and Facebook's Documentation is very cryptic and terrible.
In the documentation (http://developers.facebook.com/docs/reference/api/user/), it says "An array of JSON objects containing employer, location, position, start_date and end_date fields". I assumed I would access this by doing something along the lines of <?php echo $me[work]; ?>
however that only returns "array" in the output.
I've tried various things such as <?php echo $me[work][employer]; ?>
which didn't work either.
Any help would be appreciated and recognized!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试执行
var_dump($me['work'])
或其他操作来更清楚地了解该变量内部的内容。此外,您可以通过调用
$fb_object->getAccessToken();
获取访问令牌,并在此 URL 中使用它:https://graph.facebook.com/me?access_token= <无论如何>
。在浏览器中导航到该位置将显示返回的数据,以便您可以更好地了解格式。var_dump
文档Try doing a
var_dump($me['work'])
or whatever to get a clearer look into what's inside that variable.Additionally, you can get your access token by calling
$fb_object->getAccessToken();
and use that in this URL:https://graph.facebook.com/me?access_token=<whatever>
. Navigating to that in your browser will show you what data is coming back so you can get a better idea of the formatting.var_dump
documentation