内容无粉丝到内容粉丝
当用户单击“类似”按钮时(它直接使用新内容重新加载页面),我想更改页面的内容。
我可以做到这一点,但前提是我首先单击登录按钮以获取我的帐户的基本信息。我不想要求这一步。
我想要的一个例子是 https://www.facebook.com/Dior (选项卡 Dior VIII )。
I would like to change the content of my page, when the user clicks on a like button (it's directly reloading the page with the new content).
I can do that but only if I click on the log-in button first to get the basic information of my account. I don't want to require this step.
An exemple of what I want is at https://www.facebook.com/Dior (tab Dior VIII).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您将需要使用其中一个 SDK 来实现例程。 Facebook 将所谓的签名请求传递给所有画布应用程序以及在 iframe 中运行的此类应用程序。除此之外,它还包括当前用户是否喜欢该页面的信息。您需要检索信息并检查类似状态。
对于 PHP 来说,这将是这样的:
You will needs to implement a routine using one of the SDKs. Facebook passes a so-called signed request to all canvas apps and such running in an iframe. Among other things it includes the information if the current user has liked the page. You need to retrieve the information and check the like status.
For PHP this would be something like this:
有一个名为
getSignedRequest()
的方法。调用这个方法。此方法返回当前用户是否已经是 Facebook 页面的粉丝:There is a method named
getSignedRequest()
. Call this method. This method returns if the current user is already a fan of the Facebook page or not:有一种更简单的方法可以使用 FB.Event.Subscribe 和边缘.创建。 JavaScript 代码位于
http:// Fivespot.me/like-reveal-simple.txt
中。将此添加到您的着陆页,更改应用程序 ID 以及您想要在用户点赞
yoursite.com/afterlike.html
后重定向到的链接。这是最简单、最有效的方法。
There is a much easier way of doing this using FB.Event.Subscribe and edge.create. The JavaScript code is in
http://fivespot.me/like-reveal-simple.txt
.Add this to your landing page, change the application ID and the link you want to redirect to after the user likes where it says
yoursite.com/afterlike.html
.This is the simplest most effective way of doing this.
页面收到签名的请求。对此进行解码以查明用户是否喜欢该页面。在 PHP 中:
A page gets a signed request. Decode this to find out if the user has like the page. In PHP: