您必须先致电javascript客户端注销第一个,然后将它们发送到您的PHP注销脚本。所以,调用.js文件:
FB.Connect.logoutAndRedirect("/path/to/zend/logout/controller");
你会看到一个模式弹出,说:“你要登录这个网站和Facebook *您会被重定向到任何地方您注销脚本是:
try
{
$facebook->expire_session();
}
catch (FacebookRestClientException $e)
{
//you'll want to catch this
//it fails all the time
}
我平时也呼吁在PHP脚本注销此功能,只要是安全的:
/**
* Remove the local Facebook cookies that get set manually
*
* @return void
*/
protected function _killFacebookCookies()
{
// get your api key
$apiKey = $this->getConfig()->getApiKey();
// get name of the cookie
$cookie = $this->getConfig()->getCookieName();
$cookies = array('user', 'session_key', 'expires', 'ss');
foreach ($cookies as $name)
{
setcookie($apiKey . '_' . $name, false, time() - 3600);
unset($_COOKIE[$apiKey . '_' . $name]);
}
setcookie($apiKey, false, time() - 3600);
unset($_COOKIE[$apiKey]);
}
谢谢!有用! :) – Abhinav 2009-09-07 13:28:17
yeap,作品!测试它没有额外的功能_killFacebookCookies(),工作正常。 – Alex 2010-04-23 12:50:02