1

我需要获得一个锚标记来删除 php 中的会话 + 将用户从 Facebook 中注销。在我使用 Facebook connect 之前,我使用这个 php 代码来销毁会话:

    if(isset($_GET['logoff'])){
    $_SESSION = array();

 session_destroy();

 header("Location: /");
 exit;
}

这对于锚标签:

<a href='?logoff'>Log Out</a>

我现在需要相同的锚标记才能转到 $logoutUrl + 销毁会话。

4

2 回答 2

3

我可能是错的,但我很确定 Facebook 将访问令牌保存在一个名为 fbs_YOURAPPID 的 cookie 中。因此,只需销毁该 cookie,您就应该退出。

于 2010-11-21T22:10:16.850 回答
1

这适用于我的应用程序

if(isset($_GET['logout'])=='1'){

if (isset($_SESSION['fb_' . $app_id . '_code'])) {
    unset ($_SESSION['fb_' . $app_id . '_code']);
}
if (isset($_SESSION['fb_' . $app_id . '_access_token'])) {
    unset ($_SESSION['fb_' . $app_id . '_access_token']);
}
if (isset($_SESSION['fb_' . $app_id . '_user_id'])) {
    unset ($_SESSION['fb_' . $app_id . '_user_id']);
}
}
于 2012-11-07T22:28:23.450 回答