dsjpqpdm620596 2016-12-28 10:31
浏览 38

从facebook codeigniter登录中保存数据

I have a problem in this part of my code, where i want to insert it my model named user_model with a function of checkUser2. How can i insert this data from my database, i have no error but i cannot var_dump the data that i want to insert into my database.

 public function facebook_request(){
        $this->load->library('facebook/src/facebook', array('appId' => '1027885817316593', 'secret' => '6db175699897b514bf4881955b2944bb'));
        $this->user = $this->facebook->getUser();
        if ($this->user) {
            $data['user_profile'] = $this->facebook->api('/me?fields=id,first_name,last_name,email,link,gender,locale,picture');

            // Get logout url of facebook
            $data['logout_url'] = $this->facebook->getLogoutUrl(array('next' => base_url() . 'index.php/oauth_login/logout'));
                $data = array(
                    'oauth_provider'=> 'facebook',
                    'oauth_uid'     => $data['user_profile']['id'],
                    'first_name'    => $data['user_profile']['first_name'],
                    'last_name'     => $data['user_profile']['last_name'],
                    'email'         => $data['user_profile']['email'],
                    'gender'        => $data['user_profile']['gender'],
                    'locale'        => $data['user_profile']['locale'],
                    'picture'       => $data['user_profile']['picture']['data']['url'],
                    'link'          => $data['user_profile']['link']
                );
                $userData = $this->user_model->checkUser2($data);

                var_dump($data);
            // Send data to profile page
            $this->load->view('admin/profile.php', $data);


        } 
        else {

            // Store users facebook login url
            $data['login_url'] = $this->facebook->getLoginUrl();
            $this->load->view('auth/profile.php', $data);
        }

with model :

 function checkUser2($userData){
    $this->db->insert('tbl_oauth', $userData);
    return $this->db->insert_id();
}

here is my table screenshot details: enter image description here

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 虚拟机打包apk出现错误
    • ¥30 最小化遗憾贪心算法上界
    • ¥15 用visual studi code完成html页面
    • ¥15 聚类分析或者python进行数据分析
    • ¥15 逻辑谓词和消解原理的运用
    • ¥15 三菱伺服电机按启动按钮有使能但不动作
    • ¥15 js,页面2返回页面1时定位进入的设备
    • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
    • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
    • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝