我使用该代码连接到 facebook
// Get User ID
$user = $facebook->getUser();
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
ob_clean();
// Login or logout url will be needed depending on current user state.
if ($user) {
$logoutUrl = $facebook->getLogoutUrl();
} else {
$loginUrl = $facebook->getLoginUrl();
}
然后从 facebook 注销
if ($user): ?>
<a href="<?php echo $logoutUrl; ?>">Logout</a>
<?php else: ?>
<a href="<?php echo $loginUrl; ?>">Login with Facebook</a>
<?php endif;
如果用户单击链接,则注销。但我只想运行速度代码。不链接。在页面中,我将在我写的地方工作。
我确实喜欢,但没有工作
header('Location: '.$logoutUrl );
总结一下:在我的页面中,我不仅要在我的 cookie 中注销,还要在 facebook 上注销。
像那样:
if(!isset($_COOKIE["kullanici"]))
{
echo "Giriþ yapmamýþsýnýz Bu sayfaya giriþ izniniz yoktur...";
exit();
}
else
{
setcookie("kullanici_mail", "", time()-3600,"/");
if($user)
// here FACBOOK LOGOUT CODE SHOULD BE
// AND THAN GO
?>
<script language="JavaScript">
<!-- Sakla
parent.location.href="../index.php";
// -->
</script>
<?
}