Codeigniter会话查询中的未知值

时间:2016-01-25 19:28:17

标签: php codeigniter codeigniter-3

我需要帮助解决我无法解决的会话问题。

我有这个控制器

function update_listing_id() {
    if($this->session->userdata('is_logged_in')){
    $username = $this->session->userdata('v_member_username');
    $id = $this->uri->segment(3);

    $this->my_listings_model->keep_property_id_in_session($id);
    $this->load->view('view');

在模型中

public function keep_property_id_in_session($id) {
    if($id) {
        $this->session->set_userdata('property_id', $id);
        return $id;
    }
    elseif($this->session->userdata('property_id')) {
        $id = $this->session->userdata('property_id');
        return $id;
    } else {
        $id ="";
        return $id;
    }
}

现在我想将会话中的这个id传递给另一个像这样的

public function change_location() {
    if($this->session->userdata('is_logged_in')){
    $username = $this->session->userdata('v_member_username');
    $id = $this->my_listings_model->keep_property_id_in_session($this->session->userdata('property_id'));
    //$id = $this->session->userdata('property_id'); Either this

    $this->load->view('view');

现在问题出现了..

此会话变量$ id echo word“images”。我不知道它来自哪里。

如果我echo '<pre>'; print_r($this->session->all_userdata()); die;,则会显示:

Array
  (
    [__ci_last_regenerate] => 1453749373
    [v_member_username] => decent_dev
    [is_logged_in] => 1
    [property_id] => images
  )

0 个答案:

没有答案