2011-03-11 98 views

回答

0

如果用戶連接到你的頁面/應用程序(例如,如果他們喜歡它),你應該能夠做這樣的事情:

<div id="fb-root"></div> 
    <script src="http://connect.facebook.net/en_US/all.js"></script> 
    <script type="text/javascript"> 
    FB.init({ 
    appId : '<?= $app_id; ?>', 
    status : true, // check login status 
    cookie : true, // enable cookies to allow the server to access the session 
    oauth : true // enable OAuth 2.0 
    }); 
    function friends() { 
    FB.api('/me/friends', function(response) { 
     console.log(response); 
    }); 
    } 
    </script> 

    <button onclick="friends();return false;">Show friends</button> 

那麼這將是你來遍歷response.data並決定要做什麼。我只是在一個頁面上測試了它,它似乎工作正常。