[英]session checking not working in codeigniter
I use to set the session in my login controller is like this 我用来在我的登录控制器中设置会话是这样的
$this->session->set_userdata('logged_in', $session_data);
I used a code for checking session in CodeIgniter for all the controllers 我在CodeIgniter中使用了一个代码来检查所有控制器的会话
if(!$this->session->userdata['logged_in'])
{
redirect("xxx");
}
else {
}
but this code works fine when I working on the local server but while I uploading it to live server It doesn't work. 但是当我在本地服务器上工作但将其上载到实时服务器时,此代码工作正常。 please help...
请帮忙...
You need load session before you use it 使用前需要加载会话
$this->load->library('session');
Dont check session in this way 不要以这种方式检查会话
if($this->session->userdata['logged_in']!='')
{
redirect("xxx");
}
else {
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.