Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Facebook检查IsFan不工作,请帮助_Facebook_Facebook Graph Api - Fatal编程技术网

Facebook检查IsFan不工作,请帮助

Facebook检查IsFan不工作,请帮助,facebook,facebook-graph-api,Facebook,Facebook Graph Api,将此作为参考的起点: 首先要注意的是FB.init调用是如何包装的: <script type="text/javascript"> window.fbAsyncInit = function() { FB.init({appId: '197724456937488', status: true, cookie: true, xfbml: true}); // this will fire when any o

将此作为参考的起点:

首先要注意的是FB.init调用是如何包装的:

    <script type="text/javascript">
        window.fbAsyncInit = function() {
            FB.init({appId: '197724456937488', status: true, cookie: true, xfbml: true});

            // this will fire when any of the like widgets are "liked" by the user
FB.Event.subscribe('edge.create', function(response) {

         document.getElementById('likepost').style.display = "";
             document.getElementById('falsebox').style.display = "none";
              document.getElementById('fb').style.display = "";

});

FB.Event.subscribe('edge.remove', function(response) {
    console.log('This was UNliked from this page: ' + window.location);
});
        };
        (function() {
            var e = document.createElement('script');
            e.type = 'text/javascript';
            e.src = document.location.protocol +
                '//connect.facebook.net/en_US/all.js';
            e.async = true;
            document.getElementById('fb-root').appendChild(e);
        }());

    </script>

    <div id="fb" style="display:none">    
    <fb:like-box href="<?php echo $detail['Post_FB'] ;?>" width="292" height="100" show_faces="false" stream="false" header="false"></fb:like-box>
    </div>
    <div id="link" style="display:none">
    <fb:like href="http://design-pro.co.cc/appleworld/post.php?id=<?php echo $id?>" send="false" width="450" show_faces="true" font=""></fb:like>     
    </div>
您已经在init调用中将“status”设置为true,因此您应该能够订阅一个事件,该事件将返回status值,告诉您用户的登录状态

退房:

你的FB.Event.subscribe。。。调用也应该在同一个window.fbAsyninit调用中

验证用户登录后,可以检查风扇状态。您仍然必须使用旧的REST API,因为Facebook尚未将其移植到Graph API:

请注意:我们正在进行 正在弃用REST API,并将 向图形添加等效支持 此方法的API。你应该 继续使用此方法,直到我们 在Graph API中宣布支持

希望这能为你指明正确的方向


本教程也可能有帮助:

谢谢。我已经修改了代码,它可以在一些facebook帐户上正确地检测到iFan,但是我的一些朋友facebook帐户返回了iFan,即使他们不喜欢这个页面。你知道为什么吗?
window.fbAsyncInit = function() {
  ...
};