Codeigniter会话丢失了

时间:2015-02-16 12:10:29

标签: codeigniter session

我将codeigniter用于项目,我的会话配置为使用mysql数据库:

$config['sess_cookie_name']     = 'ci_session';
$config['sess_expiration']      = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie']  = FALSE;
$config['sess_use_database']    = TRUE;
$config['sess_table_name']      = 'ci_sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update']  = 300;

在我的控制器中,我有一个这样的代码:

$params = array(
        "type"      => $data['activite_name'],
        "activite"  => $data['activite'],
        "nom"       => $data['name'],
        "prenom"    => $data['fname'],
        "tel"       => $data['tel'],
        "email"     => $data['email'],
        "adresse"   => $data['adr'],
        "cp"        => $data['cp'],
        "ville"     => $data['ville']
    );
....
#Load session library and save $params as session
$this->load->library('session');
$this->session->set_userdata($params);

#Test session
$sess_name = $this->session->userdata('name');
echo $sess_name;

#Load view
$this->load->view("templates/header_interne", $data);
$this->load->view("pages/payment_view", $data);
$this->load->view("templates/footer", $data);

因此,当加载payment_view时,我可以看到我的$ sess_name值,但是当我刷新页面时,我丢失了这个会话,等等我的所有会话。

有人有想法吗?

谢谢。

0 个答案:

没有答案