简体   繁体   中英

Facebook connect log out still showing user

I am using the following code and it's v strange - when i log out, if i try to actually go back into facebook i cannot but my code below does not register that i'm logged out and will show my facebook user id still

include '/home/php_/lib/fb_libs/facebook.php';

$facebook = new Facebook(array(
  'appId'  => '123456789',
  'secret' => 'abcdefghilk',
  'cookie' => true
));

$user = $facebook->getUser();

echo "user id is $user"; 

if ($user){

    try { $user_profile = $facebook->api('/me'); }

    catch (FacebookApiException $e) { echo $e->getMessage(); }
}

if ($user)
{
    $logoutURL = $facebook->getLogoutURL();
    echo "<a href='$logoutURL'>Log out </a>";
}

else 
{
    $loginURL = $facebook->getLoginURL(array(
        'scope' => 'publish_stream,read_friendslists'
    ));
    echo "<a href='$loginURL'>Log in </a>";
}

I understand there are other methods eg FB.getLoginStatus() so this is not a duplicate question but why, when this is on github facebook SDK, does it not work?

我认为您的Cookie引起了问题,请尝试不设置Cookie。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM