簡體   English   中英

使用codeigniter在localhost上運行但無法在服務器上運行的facebook登錄

[英]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');
}

當echo error_log($ e)顯示(1)而var_dump(error_log($ e))顯示bool(true)時

但在本地主機工作正常

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM