Does facebook Like Button return any value (PHP)?

被刻印的时光 ゝ 提交于 2019-12-06 12:09:04

问题


I want to execute another function after user like my webpage.

Does facebook Like Button return any value like true or false. So I can perform any operation after ?

Or is there another alternative ??


回答1:


You'll have to use the Javascript API to do this:

FB.Event.subscribe('edge.create',
    function(response) {
        console.log("Here is the response %o", response);
    }
);



回答2:


AFAIK, "FB Like" is JavaScript addon (not PHP), but you could bind JS event to like button, that would send some AJAX data to your server, notifying it, about usage of Like button. Even thou, I'm not sure about my answer.




回答3:


You can subscribe to events edge.create and edge.remove they are used for tracking the firing of liking and unliking events respectively..

as a simple check add alert() in the response function to see if you got it right..

   FB.Event.subscribe('edge.create', function(response) {
    // A user liked the item, read the response and handle
    alert("like event detected");
  });

 FB.Event.subscribe('edge.remove', function(response) {
    // A user liked the item, read the response and handle
    alert("unlike event detected");

  });


来源:https://stackoverflow.com/questions/7171270/does-facebook-like-button-return-any-value-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!