codeigniter cookie expiry problem

后端 未结 3 1645
别跟我提以往
别跟我提以往 2021-01-19 07:19

I\'m having a cookie issue, the expiry date on my cookie is always being set to At End Of Session which isn\'t what I want. I did a bit of goggling and it suggested it set t

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-19 08:09

    You can add params

    $config['cookie_lifetime']  = 1800
    

    in config.php, the reason you can find in libraries/Sessions/Session.php, code below

    $expiration = config_item('sess_expiration');
    
    if (isset($params['cookie_lifetime']))
    {
        $params['cookie_lifetime'] = (int) $params['cookie_lifetime'];
    }
    else
    {
        $params['cookie_lifetime'] = (!isset($expiration) && config_item('sess_expire_on_close'))
            ? 0 : (int) $expiration;
    }
    

提交回复
热议问题