Codeigniter flashdata not working in internet expl

2019-02-28 12:18发布

问题:

Codeigniter flashdata not working in internet explorer and chrome but it is working on firefox.What could be the issue?.

In My controller:-

$this->session->set_flashdata('login_error','Your username or password is incorrect.');
redirect(base_url().'admin/login');

In My view

echo  '<span>'.$this->session->flashdata('login_error').'</span>';

In Chrome and ie i'm getting blank span whereas in firefox it is displaying flash data.

There are similar questions on the stack but i could not find any answer which are working.

回答1:

I solved my problem.There was some issue with ie and chrome cookie management.

I change the 'sess_cookie_name' in config from 'ci_session' to 'cisession'

and sess_expiration from 7200 to 84200 and it got fixed.



回答2:

I was able to solve the problem by setting:

$config['sess_use_database']= FALSE;
$config['sess_cookie_name']= 'cisession';
$config['sess_expiration'] = 84200;