1
我對我的CI認證使用ion認證。註冊後我遇到了自動登錄問題。我沒有註冊的問題,所有的數據都被插入,我可以登錄我的登錄表單。但是在用戶註冊後它不會重定向到主頁。離子認證在註冊後不會重定向
下面是我的代碼。任何人都可以看看嗎?
if ($this->form_validation->run() == TRUE)
{
//if form validation not false, password var
$username = $this->input->post('email');
$password = $this->input->post('password');
$email = $this->input->post('email');
$additional_data = array(
'first_name' => $this->input->post('first_name'),
'last_name' => $this->input->post('last_name'),
);
}
if ($this->form_validation->run() == TRUE && $this->ion_auth->register($username, $password, $email, $additional_data))
{
//check to see if we are creating the user
//redirect them back to the home page
$this->session->set_flashdata('msg', "User Created");
redirect("auth/home", 'refresh');
}
else
{
$this->session->set_flashdata('msg', validation_errors('<div>','</div>'));
redirect('auth/index','refresh');
}
您是否檢查過錯誤,例如代碼中的通知?在此代碼之前啓用顯示錯誤並搜索空白/製表符,如果某些輸出已經通過重定向使用標題,則通常不會重定向。 – 2012-07-07 22:26:17
沒有錯誤。它實際上重定向,但它重定向到登錄頁面,我不得不手動登錄 – vzhen 2012-07-07 22:40:03