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 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 对于相关问题的求解与代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料
    • ¥15 使用R语言marginaleffects包进行边际效应图绘制