为什么我的变量在Codeigniter中从Controller传递给Model时会损坏

K.K*_*ith 0 php codeigniter

我很烦.

我将一个变量从Controller方法传递给Method,不知何故它在传输中被改变了.最初它被愚蠢地称为$id..所以我认为可能会有一些变量干扰...但我改变了名称,问题仍然存在.

谁能告诉我可能会发生什么?

这是代码..检查我的评论

public function firstFbLogin()
{
    ChromePhp::log('AJAX - first FB login');  // logs fine
    $username          = $this->input->post('username');
    $first_name        = $this->input->post('first_name');
    $last_name         = $this->input->post('last_name');
    $facebookId        = $this->input->post('facebookId');
    $email             = $this->input->post('email');
    $third_party_id    = $this->input->post('third_party_id');
    $gender         = $this->input->post('gender');
    $this->Member_model->mFirstFbLogin($username, $first_name, $last_name, $email, $facebookId, $third_party_id, $gender);
            // here comes the issue..
    $idFromFbDooDaDay = $this->Member_model->mFetchIdFromFacebook($facebookId);
    ChromePhp::log("Id found and going out of ajax - firstFbLogin is ". $idFromFbDooDaDay); // <<< this logs 232 which is what I am expecting
    $this->Member_model->mCreateProfilePage($username, $first_name, $last_name, $idFromFbDooDaDay, $third_party_id, $gender);
    echo "TRUE";
}
Run Code Online (Sandbox Code Playgroud)

但是在我的Member_model上我有这个(我会编辑一堆)

    public function mCreateProfilePage($username, $first_name, $last_name, $gender, $idFromFbDooDaDay, $third_party_id)
    {
        // lets create a 'profile.html' used for FB object interaction
        $this->load->helper('file');
        ChromePhp::log('Id coming into mCreateProfilePage is ' . $idFromFbDooDaDay);  // this logs as D0k9f7LxtjIHMhGnbn6UkhDk3ao  WTF!?!
        $data = "<html>\n";
        $data .= "<head prefix=\"og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# profile: http://ogp.me/ns/profile#\">\n";
        $data .= "<meta property=\"fb:app_id\" content=\"32xxxxxxxxxxxx6\" />\n"; // my APP ID
        $data .= "<meta property=\"og:type\"   content=\"profile\" />\n";  // stays profile
        $data .= "<meta property=\"og:url\"    content=\"www.MYSITE.com/profiles/id-".$idFromFbDooDaDay."\" />\n"; // put the URL
        $data .= "<meta property=\"og:image\"  content=\"https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png\" />\n";  // url to bigPic

 ... edit ...

        $file_path = 'profiles/id-' . $idFromFbDooDaDay . '.html';

        if (!write_file($file_path, $data))
        {
             ChromePhp::log('Problem writing profile');
        }
        else
        {
             ChromePhp::log('Profile written to '. $file_path);
        }
    }
Run Code Online (Sandbox Code Playgroud)

那么在从控制器到模型的简单传递范围内,这又如何$idFromFbDooDaDay = 232变成一个27个字符的噩梦$idFromFbDOoDaDay = D0k9f7LxtjIHMhGnbn6UkhDk3ao呢?

它不能是可变干扰..就我所知,没有别的东西可以触及var.怎么了?

Tod*_*ish 5

// $this->Member_model->
mCreateProfilePage($username, $first_name, $last_name, $idFromFbDooDaDay, $third_party_id, $gender);
// public function 
mCreateProfilePage($username, $first_name, $last_name, $gender, $idFromFbDooDaDay, $third_party_id)
Run Code Online (Sandbox Code Playgroud)

你的论点不匹配,这可能是为什么:)