我在page.php上有一個註銷按鈕,用作鏈接,點擊後將用戶指向logout_facebook.php。問題是註銷從未發生,而只是引導用戶訪問Facebook主頁。我該如何解決?Facebook PHP API getLogOutUrl()不起作用
示例代碼
<?php
require_once('engine/facebook/facebook.php');
//Application Configurations (Facebook)
$app_id ="XXXXXX";
$app_secret="XXXXXXX";
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true
));
$logoutUrl = $facebook->getLogoutUrl(array('next' => ($fbconfig['baseurl'].'logout.php')));
//on logout page
setcookie('fbs_'.$facebook->getAppId(), '', time()-100, '/', '.mydomain.com');
session_destroy();
header('Location:'.$logoutUrl);
/*$facebook->destroySession();
header('Location: http://mydomain.com/index.php?lo=facebook&ad=1');*/
?>