drb56625 2015-10-06 13:20
浏览 87

在codeigniter中登录后,会话在刷新时到期

I am putting the following in the config file:

$config['sess_cookie_name']     = 'ci_session';

$config['sess_expiration']      = 0;

$config['sess_expire_on_close'] = FALSE;

$config['sess_encrypt_cookie']  = FALSE;

$config['sess_use_database']    = FALSE;

$config['sess_table_name']      = 'ci_sessions';

$config['sess_match_ip']        = FALSE;

$config['sess_match_useragent'] = FALSE;

$config['sess_time_to_update']  = 86400;

I am using the codeigniter framework.

In login page, I am storing the username in session, after login the session username is loading, once I refresh the page the name has gone.

What might be the problem? I extended the session expiry and everything but it is not working.

  • 写回答

2条回答 默认 最新

  • dsg435665475 2015-10-07 03:31
    关注

    Try these settings, following are working for me,

    $config['sess_cookie_name'] = 'ci_session';
    $config['sess_expiration'] = 60*60*24;
    $config['sess_save_path'] = 'ci_sessions';
    $config['sess_match_ip'] = FALSE;
    $config['sess_time_to_update'] = 300;
    $config['sess_regenerate_destroy'] = FALSE;
    

    You have set $config['sess_expiration'] = 0; that means it wont last a second

    and you have missed this one $config['sess_regenerate_destroy'] = FALSE;

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起