我正在使用codeigniter,並使用javascript sdk/php sdk。但是,從getLogoutUrl()生成的註銷url也會在facebook.com上註銷我的帳戶。如何註銷Facebook的應用程序網站,而無需登出facebook.com
任何函數只爲我的網站應用程序清除會話..?
我正在使用codeigniter,並使用javascript sdk/php sdk。但是,從getLogoutUrl()生成的註銷url也會在facebook.com上註銷我的帳戶。如何註銷Facebook的應用程序網站,而無需登出facebook.com
任何函數只爲我的網站應用程序清除會話..?
以下添加到您的網站頁面的最開始
session_start();
if($_GET['logoutfrmfb']=="logout")
{
unset($_SESSION['fb_{your app id}_code']);
unset($_SESSION['fb_{your app id}_access_token']);
unset($_SESSION['fb_{your app id}_user_id']);
}
查找和編輯的src/base_facebook.php以下行(可能是線506-515)
public function getLogoutUrl($params=array()) {
return $this->getUrl(
'www',
'logout.php',
array_merge(array(
'next' => $this->getCurrentUrl().'?logoutfrmfb=logout',
'access_token' => $this->getAccessToken(),
), $params)
);
}
作品我!
您可以撤消僅適用於您的應用程序的權限。看看這個頁面:
http://developers.facebook.com/docs/howtos/login/server-side-logout/
以下是轉述的PHP代碼來實現:
$token = $_SESSION["access_token"];
if($token)
{
$graph_url = "https://graph.facebook.com/me/permissions?method=delete&access_token=".$token;
$result = json_decode(file_get_contents($graph_url));
}
else
{
echo("User already logged out.");
}
是..我有同樣的問題..你可以做這樣做只是以下:
在你的頁面註銷按鈕或圖片:
<a href="logout.php">Log Out</a>
logout.php ------------------------------------------->
<?php
require 'facebook.php'; //including the facebook php sdk
$facebook->destroySession();
header("location:index.php");
?>
使用facebook=>getLogoutUrl();
< < < < <這使得當你facebook.com註銷...
我希望這是你正在尋找:)
究竟是不是,對Facebook的政策? –