douhao123457 2018-11-14 19:08
浏览 46

在codeigniter 3中重定向后会话被破坏

the issue i am facing is when i redirect to some page my session got destroyed. i am facing this issue in live server only and working flawlessly in localhost. this issue was not there few months ago on different hosting company

here is my session configuration

$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

$config['cookie_prefix']    = '';
$config['cookie_domain']    = '';
$config['cookie_path']      = '/';
$config['cookie_secure']    = FALSE;
$config['cookie_httponly']  = FALSE;
  • 写回答

1条回答 默认 最新

  • dongsheng6056 2018-11-14 20:20
    关注

    You are using the "files" driver so you must supply a path to $config['sess_save_path']. You set the value to NULL which will not work.

    The value assigned to $config['sess_save_path'] must be a full, absolute, path and must have the appropriate owner and permission settings. Documentation on the files driver.

    For reasons of security, many devs create a folder on the same level as the website public folder. If that folder is named "sessions" then you could set the config like this

    $config['sess_save_path'] = dirname(FCPATH .'/sessions/'); 
    

    The other thing to try is being explicit with the cookie_domain, ie.

    $config['cookie_domain']    = '.yourdomain.tld';
    

    Be sure to include the leading dot.

    评论

报告相同问题?

悬赏问题

  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器