Codeigniter增加会话超时时间不工作 [英] Codeigniter increase session time out not working

查看:410
本文介绍了Codeigniter增加会话超时时间不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新的codeigniter框架。我有一个问题与会话超时与页面。
现在我已经启用了ip匹配,用户代理匹配但不工作。
我试过更新的2.1.4库文件和复制到我的系统
文件夹,但这也没有工作。更多的方式。

I am new to codeigniter framework. I have a problem with session time out with pages. Right now I had enabled with the ip match ,user agent matching but doesn't work. One more way I had tried with updated the 2.1.4 libraries files and copied into my systems folders but this is also not worked.

请帮助我解决会话超时问题。我在
config-> config.php中使用了以下代码。

Please help me to solve the session time out problem.the following code I had used in config->config.php.

$config['sess_cookie_name']     = 'ci_session';
$config['sess_expiration']      = 10; 
$config['sess_expire_on_close'] = TRUE;
$config['sess_encrypt_cookie']  = FALSE;
$config['sess_use_database']    = FALSE;
$config['sess_table_name']      = 'ci_sessions';
$config['sess_match_ip']        = TRUE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update']  = 10;

我需要增加会话超时时间,但现在我需要检查会话时间
out is working or not。如果这10秒会话时间正在工作,那么我可以
增加会话时间。

I need to increase the session time out time but now i need to check the session time out is working or not.if this 10 seconds session time is working then i can able to increase the session time.

感谢提前请帮助我。

推荐答案

最后我找到了问题的解决方案。

Finally i found the solution for the problem.

以下方式增加或减少会话超时。
1。

The following ways to increase or decrease the session time out. 1.

  ini_set('session.gc_maxlifetime', 60);

  config->config.php

  $config['sess_expiration'] = ''; //in seconds.

2。

 $config['sess_time_to_update'] = '' ;//in seconds (as same in sess_expiration seconds)


b $ b

3.如果您检入登录控制器和所有控制器的会话数据为

3.If you are checking in login controller and all controller for the session data as

$_SESSION['data'] == 'your login id or role or something

。会话数据。但我们需要检查与 $ this-> session->
userdata('您的id或数据需要检查')
,然后一次登录成功,然后需要
将值分配给会话 $ this > session-> set_userdata('your id or something');

.this is not getting session expired the session datas.but we need to check the check with $this->session-> userdata('your id or data need to check') and before once login successfull then need to assign the value to the session as $this->session->set_userdata('your id or something');

$ this-> session-> userdata()为空或零需要 session_destory(),然后需要重定向到您的主页。
另一种增加方式:

while checking the session = $this->session->userdata() is empty or zero need to session_destory() and then need to redirect to your home page. Another way to increase :


  1. 如果您的网站在apache2中运行,并且只有一个网站,我们可以直接提及
    the session_gc_maxtime。

这两种方式我试过,我发现解决方案的会话时间out.its工作正常为我。

These two ways i had tried and i found the solution for the session time out.its working fine for me.

感谢所有。

这篇关于Codeigniter增加会话超时时间不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆