We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
我最近编写了一个应用程序,可以将其作为页面选项卡添加到用户的页面。因此,现在每当有人在用户页面中单击我的应用程序的选项卡时,该应用程序都会获取一个
signed_request
作为$_POST
参数。它包含大量可以使用的有用信息,例如用户 id 字段、包含页面 id 的页面字段和一些布尔字段来指示用户是否喜欢该页面,或者用户是否是管理员,以及一些更多领域。 (请参阅我提到的链接)。然后我只是从所述
signed_request
中解码并提取不同的字段。因此,您可能应该做同样的事情,并查明用户或页面是否正在访问应用程序。我提到的 Facebook 文档中给出了示例代码,其链接位于本答案的末尾.
据我所知,Facebook 总是将此
signed_request
发送到用户访问的任何应用程序,因此您始终可以解析它。希望这对您有帮助,如果您想要我的代码,请发表评论,我将用代码跟进:)。
您可以参考有关
signed_request
的 Facebook 文档 此处。i recently wrote an app, which can be added to a user's page, as a page tab. So now whenever someone clicks the tab for my app, in the user's page, the app gets a
signed_request
as a$_POST
parameter. It contains loads of useful information, which can be used, like a field for user id, a page field which contains the page id and some boolean fields to indicate if the user has liked the page, or if the user is admin, and some more fields. (See the link i have mentioned).Then i just decode and extract the different fields from the said
signed_request
. So you should probably be doing the same, and find out if app is being visited by user or a page.There is sample code given in the Facebook documentation that i referred, the link to which is at the end of this answer.
As far as i know, Facebook always sends this
signed_request
to any app a user visits, so u can always parse it.Hope this helps you, if you want my code, leave a comment, and i shall follow it up with code :) .
You can refer the Facebook documentation regarding
signed_request
here.signed_request
的正确链接:http://developers.facebook.com/文档/身份验证/signed_request/Correct link for
signed_request
: http://developers.facebook.com/docs/authentication/signed_request/