1

I'm trying to simply log a user out of fb before continuing on to log them out of my system.

Here's what I'm trying:

require_once '/src/facebook.php';

    $facebook = new Facebook(array( 'appId'  => 'MY_APP_ID', 'secret' => 'MY_SECRET' ));
    $fb_userID = null;
    $fb_userID = $facebook->getUser();
    $access_token = $facebook->getAccessToken();

    if($fb_userID){

    $logoutUrl = $facebook->getLogoutUrl( array ('next' => 'http://myurl.com/pages/userlogin.html?logoff=true')); 

    }

echo "<a href="$logoutUrl">Log-out</a>";

When I do this not only does it not work but the end of the URL shows access_token=0

If I try the following instead I get the access token but it stil doesn't work

$logoutUrl = "https://www.facebook.com/logout.php?next=http://myurl.com/pages/userlogin.html?logoff=true&access_token=$access_token";

Is there a better way of doing this?

4

1 回答 1

0

在 getLogoutUrl 不起作用时强制注销:

$app_config = array(
  'appId' => '1234567',
  'secret' => '7722b9foobar00foobar'
);
$facebook = new Facebook($app_config);
$facebook->destroySession();
session_destroy();
于 2012-12-11T01:54:29.823 回答