如何在codeigniter控制器

时间:2016-12-29 01:32:27

标签: php codeigniter debugging variables controller

我想问一下如何在我的代码中检查/查看此$datame内部的值,我尝试var_dump它,我使用的是mozilla,它没有显示控制台/网络中的值。我在哪里或如何检查我的变量数组中是否存有数据。

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'));

                $datame = 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($datame);
                var_dump($datame);
                exit();

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

        } 

2 个答案:

答案 0 :(得分:0)

服务器无权写入。您可以将$datame传递给您尝试呈现的视图并将其打印在那里,也可以将var_dump($datame)替换为error_log($datame),然后查看错误日志以查看其打印内容

答案 1 :(得分:0)

改变
$userData = $this->user_model->checkUser2($datame);
var_dump($datame);
exit();

echo "<pre>";
print_r($datame);
exit();
$userData = $this->user_model->checkUser2($datame);