Php 注销对我不起作用

Php 注销对我不起作用,php,facebook,Php,Facebook,我正在尝试将facebook登录添加到我的网站。我遇到的问题是,当我点击注销链接时,它没有给出任何响应。我知道以前有人问过这类问题,但我一直在寻找我的答案,但没有找到答案,所以我最终带着希望来到这里。请帮忙 我试过的代码在这里。。。“index.php” 矢量facebook登录 window.fbAsyninit=函数(){ FB.init({ appId:'xxxxxxxxxxxx',//在此处替换您的应用程序id channelUrl:'//WWW.YOUR_DOMAIN.COM/cha

我正在尝试将facebook登录添加到我的网站。我遇到的问题是,当我点击注销链接时,它没有给出任何响应。我知道以前有人问过这类问题,但我一直在寻找我的答案,但没有找到答案,所以我最终带着希望来到这里。请帮忙

我试过的代码在这里。。。“index.php”


矢量facebook登录
window.fbAsyninit=函数(){
FB.init({
appId:'xxxxxxxxxxxx',//在此处替换您的应用程序id
channelUrl:'//WWW.YOUR_DOMAIN.COM/channel.html',
状态:正确,
曲奇:是的,
xfbml:对
});
};
(职能(d){
var js,id='facebook jssdk',ref=d.getElementsByTagName('script')[0];
if(d.getElementById(id)){return;}
js=d.createElement('script');js.id=id;js.async=true;
js.src=“//connect.facebook.net/en_US/all.js”;
ref.parentNode.insertBefore(js,ref);
}(文件);
函数FBLogin(){
FB.登录(功能(响应){
if(response.authResponse){
window.location.href=“actions.php?action=fblogin”;
}
},{scope:'email,user_likes'});
}
身体{
字体系列:Arial;
颜色:#333;
字体大小:14px;
}
这里是另一个文件“actions.php”


从错误控制台得到的任何错误?当我单击注销时,它不会给出任何错误response@AbhikChakraborty:错误控制台中没有任何内容您需要检查浏览器上的错误控制台,查看其是否显示一些JS错误。此外,您的JS加载看起来不正确。您缺少fb根检查
<?php
error_reporting(0);
include 'library.php';
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Vector facebook login</title>
<script type="text/javascript">
window.fbAsyncInit = function() {
    FB.init({
    appId      : 'XXXXXXXXXXXXX', // replace your app id here
    channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', 
    status     : true, 
    cookie     : true, 
    xfbml      : true  
    });
};
(function(d){
    var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
    if (d.getElementById(id)) {return;}
    js = d.createElement('script'); js.id = id; js.async = true;
    js.src = "//connect.facebook.net/en_US/all.js";
    ref.parentNode.insertBefore(js, ref);
}(document));

function FBLogin(){
    FB.login(function(response){
        if(response.authResponse){
            window.location.href = "actions.php?action=fblogin";
        }
    }, {scope: 'email,user_likes'});
}
</script>
<style>
body{
    font-family:Arial;
    color:#333;
    font-size:14px;
}
</style>
</head>

<body>

<img src="facebook-connect.png" alt="Fb Connect" title="Login with facebook" onclick="FBLogin();"/>
</body>
</html>
<?php
include 'library.php';
/*
CREATE TABLE `demo`.`fblogin` (
`id` INT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`fb_id` INT( 20 ) NOT NULL ,
`name` VARCHAR( 300 ) NOT NULL ,
`email` VARCHAR( 300 ) NOT NULL ,
`image` VARCHAR( 600 ) NOT NULL,
`postdate` DATETIME NOT NULL
) ENGINE = InnoDB;
*/
$action = $_REQUEST["action"];
switch($action){
    case "fblogin":
    include 'facebook.php';
    $appid      = "XXXXXXXXXXXX";
    $appsecret  = "XXXXXXXXXXXXXXXXXXXX";
    $facebook   = new Facebook(array(
        'appId' => $appid,
        'secret' => $appsecret,
        'cookie' => TRUE,
    ));
    $fbuser = $facebook->getUser();
    if ($fbuser) {
        try {
            $user_profile = $facebook->api('/me');
        }
        catch (Exception $e) {
            echo $e->getMessage();
            exit();
        }
        $user_fbid  = $fbuser;
        $user_email = $user_profile["email"];
        $user_fnmae = $user_profile["first_name"];
        $user_image = "https://graph.facebook.com/".$user_fbid."/picture?type=large";
        $check_select = mysql_num_rows(mysql_query("SELECT * FROM `fblogin` WHERE email = '$user_email'"));
        if($check_select < 1){
            mysql_query("INSERT INTO `fblogin` (fb_id, name, email, image, postdate) VALUES ('$user_fbid', '$user_fnmae', '$user_email', '$user_image', '$now')");
        }
    }
    break;
}

?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Asif18 tutorial about facebook login for mywebsite using php sdk</title>
<script id="facebook-jssdk" async="" src="//connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
window.fbAsyncInit = function() {
    FB.init({
    appId      : 'XXXXXXXXXXXXXXXXX', // replace your app id here
    channelUrl : '', 
    status     : true, 
    cookie     : true, 
    xfbml      : true  
    });
};
(function(d){
    var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
    if (d.getElementById(id)) {return;}
    js = d.createElement('script'); js.id = id; js.async = true;
    js.src = "//connect.facebook.net/en_US/all.js";
    ref.parentNode.insertBefore(js, ref);
}(document));

function FBLogout(){

    FB.logout(function(response){
        alert("inner");

        window.location.href = "index.php";
    });
}
</script>
<style>
body{
    font-family:Arial;
    color:#333;
    font-size:14px;
}
.mytable{
    margin:0 auto;
    width:600px;
    border:2px dashed #17A3F7;
}
a{
    color:#0C92BE;
    cursor:pointer;
}
</style>
</head>

<body>

<h3>here is the user details, for more details </h3>
<table class="mytable">
<tr>
    <td colspan="2" align="left"><h2>Hi <?php echo $user_fnmae; ?>,</h2><a onClick="FBLogout();">Logout</a></td>
</tr>
<tr>
    <td><b>Fb id:<?php echo $user_fbid; ?></b></td>
    <td valign="top" rowspan="2"><img src="<?php echo $user_image; ?>" height="100"/></td>
</tr>
<tr>
    <td><b>Email:<?php echo $user_email; ?></b></td>
</tr>
</table>
</body>
</html>