以下代码在php 5 *中正常工作 在我的控制器中:
$admin_login_status= $this->admin_login->check_admin_login();
if ($admin_login_status=='success')
{
// print_r($this->session->userdata());exit;
redirect(ADMIN_DASHBOARD_PATH, 'refresh');exit;
}
else
{
//some condition
}
在我的模型中,我设置了这样的会话
$query=some query
if($query->num_rows()>0)
{
$record = $query->row();
//check active admin
if($record->login_status==='active')
{
$secure_code = 'something';
$pwd_hash = hash('sha512', $pass.$secure_code.$record->login_salt);
if(strtolower($record->username)===strtolower($uname) && $record->password===$this->general->hash_password($pass,$record->login_salt))
{
$user_browser = $_SERVER['HTTP_USER_AGENT'];
$login_string = hash('sha512', $record->username.$user_browser);
$this->session->set_userdata('admin_user_id', $record->admin_id);
$this->session->set_userdata('admin_user_name', $record->username);
$this->session->set_userdata('admin_user_type', $record->role_id);
$this->session->set_userdata('nickname', $record->username);
$this->session->set_userdata('login_string', $login_string);
// $this->session->set_userdata(ADMIN_USER_TYPE, $record->user_type);
$this->log_login_success($record);
return "success";
Noe问题是当我在该控制器中print_r会话值时,它打印了所有内容:
Array ( [__ci_last_regenerate] => 1501607438 [admin_user_id] => 2 [admin_user_name] => admin [admin_user_type] => 1 [nickname] => admin [login_string] => 269c55741765ce233f4880a11a06b03def9090a6494255371af22074159f4960f349f1fd93647b31ad31e15603a6e6ab0bbf3bb30672a5b8d8d573eebbe3f20b )
。但是,当我在某个Url中重定向并访问相同的会话时,它只返回此
Array ( [__ci_last_regenerate] => 1501607438 )
它在以前版本的php中返回相同的值。 codeigniter版本是3.0.6。任何帮助?提前谢谢。