为什么在页面重定向后,codeigniter会话被破坏, 这是我的自动加载配置 $ autoload [' libraries'] =数组('数据库',' form_validation',' session'); 我的登录控制器代码是
$result = $this->Loginmodel->verify_user($this->input->post('username'), $this->input->post('password'));//returned as db->result()
if ($result !== False) {
//person has an account
foreach ($result as $obj) {
$user_id = $obj->user_id;
$userdesignation = $obj->user_designation;
$user_access = $obj->user_cpanelpass;
}
$sessiondata = array(
'user_id' => $user_id,
'username' => $username,
'loginuser' => TRUE,
'userdesignaton' => $userdesignation,
);
$this->session->set_userdata($sessiondata);
$sessiondata1 = array(
'shopname' => 'abc',
'shopplace' => 'xyz'
);
$this->session->set_userdata($sessiondata1);
$ipaddress = $this->ipaddress();
$this->Loginmodel->loginloginsert($username, $ipaddress);
redirect('home');
这在我的系统中正常工作,但在另一个系统中无效。会话在重定向到家庭或任何其他控制器时会自动销毁。