0

我很烦。

我正在将一个变量从控制器方法传递给方法,并且不知何故它在传输中发生了变化。最初它被愚蠢地称为$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";
}

但后来在我的 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);
        }
    }

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

它不可能是可变干扰..据我所知,没有其他东西接触到var。怎么了?

4

1 回答 1

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)

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

于 2013-01-22T15:12:41.710 回答