$this->session->set_userdata() 在编码器点火器中不起作用



该应用程序已经完美运行了两年多,只是我无法登录web应用程序。我发现$this->session->set_userdata((不起作用。我输入了我的凭据,然后被重定向回登录页面。我尝试在set_userdata((上使用一个语句,结果发现它不起作用。我的代码显示在下面

/* Autoload.php*/
$autoload['libraries'] = array('database', 'email', 'session');
/* Config.php */
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = BASEPATH.'sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
/* Login Controller */
public function verify_login(){
$this->load->library('session');
$pass = $this->input->post('password');
$username = $this->input->post('username');
$action = 'Login';
if($this->admodel->Check_Login_In_DB($username,$pass)){
$sess_array = array();
$sess_array = array(
'uid' =>  $this->admodel->getUidByUsername($username),
'username' => $username
);
$this->session->set_userdata($sess_array);
$this->admodel->insertLog($action,$this->admodel->getUidByUsername($username));
redirect(base_url(), 'refresh');
}else{
$this->session->set_flashdata('msg','<div style="color:#b94a48;
background-color:#f2dede;border-color:#eed3d7;height:auto;padding:5px;border-radius:3px;margin-bottom:7px;
clear:both">The Email and Password Combination is not found in the database,Check Properly and try again !!!</div>');
redirect(base_url().'login','refresh');
}
}
/* Homepage */
public function index(){
if(!$this->session->userdata('uid')){
$this->session->set_flashdata('msg','<div style="color: #b94a48;background-color:
#f2dede;border-color: #eed3d7;height:auto;padding:5px;border-radius:3px;clear:both;margin-bottom:10px">
You need to signin to continue !!!</div>');
redirect(base_url().'login','refresh');
}

请这样更改会话语法。

$this->session->set_userdata('user_session',$sess_array);

它会起作用的。

相关内容

  • 没有找到相关文章