注销后出错 [英] Error after loggin out
问题描述
我的程序正常工作..它有多个页面,如果我单击浏览器的按钮以返回,它会转到上一页:
My program works properly.. it has several pages and if i click on the button of the browser to go back, it goes to the previous page:
但是注销后出现错误。
当我注销时,该程序将我重定向到登录页面,一切似乎都正常,但不能正常工作
BUT there is an error after loggin out. When i logged out the program redirects me to the login page, everything seems to be working fine but it does not
当我单击注销时,如果我按浏览器中的按钮返回,该程序会将我重定向到登录系统,然后出现此错误:
When i click on "logout" and the program redirects me to the login system IF I press the button in the browser to go back i got this error:
不知道发生了什么事情:/
Do not know what is going on :/
这里是程序行错误:
我的代码,模型文件( m_login):
My code, the model file ("m_login"):
public function getDetails()
{
$st = $this->db->SELECT('cursadas.date as date, cursadas.grade as grade, usuarios.username as user, materias.name as subject')->from('cursadas')
->join('usuarios','usuarios.id=cursadas.user_id')
->join('materias','materias.id=cursadas.subject_id')
->WHERE('cursadas.user_id=',$this->session->userdata['id'])
->get()->result_array();
return $st;
}
我的注销功能:
public function logout(){
$this->session->sess_destroy();
redirect('login/index');
}
推荐答案
通过此方法更改getDetails()方法
// $this->session->userdata['id'] to this code $this->session->userdata('id')
public function getDetails()
{
$st = $this->db->SELECT('cursadas.date as date, cursadas.grade as grade,
usuarios.username as user, materias.name as subject')->from('cursadas')
->join('usuarios','usuarios.id=cursadas.user_id')
->join('materias','materias.id=cursadas.subject_id')
->WHERE('cursadas.user_id=',$this->session->userdata('id'))
->get()->result_array();
return $st;
}
查看链接以获取更多信息
see the link for more info
https://www.codeigniter.com /user_guide/libraries/sessions.html#retrieving-session-data
这篇关于注销后出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!