简体   繁体   中英

facebook login with codeigniter working in localhost but not working on server

function fblogin(){
    $base_url=$this->config->item('base_url');
    $facebook = new Facebook(array(
        'appId' =>  $this->config->item('appID'), 
        'secret'=> $this->config->item('appSecret'),
    ));
    $user = $facebook->getUser();
    if($user){
        try{
            $user_profile = $facebook->api('/me');

            $params = array('next' => $base_url.'Poll/logout');

            $ses_user=array(
                'User' => $user_profile,
                'logout' => $facebook->getLogoutUrl($params)
            );
            $this->session->set_userdata($ses_user);
            header('Location: '.$base_url);
        }catch(FacebookApiException $e){
            error_log($e);
            $user = NULL;
        }       
    }
    echo error_log($e);
    $user = $this->session->userdata('User');
    echo $user['id'];
    $this->load->view('main');
}

when echo error_log($e) shows (1) and var_dump(error_log($e)) shows bool(true)

but in localhost working fine

在没有js的php sdk中工作,但仍然不知道原因

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM