To use the session library in CI 3, you need to set the session save path.
要在CI 3中使用会话库,您需要设置会话保存路径。
Where should I save the sessions? (path)
我应该在哪里保存会话? (路径)
Maybe can somebody why I should use the database driver to save sessions because it's better?
也许有人为什么我应该使用数据库驱动程序来保存会话,因为它更好?
1 个解决方案
#1
You can use:
您可以使用:
$r = implode('/', array_slice(explode('/', $_SERVER["SCRIPT_FILENAME"]),0,-1));
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'my_session';
$config['sess_expiration'] = 14400;
$config['sess_save_path'] = $r.'/session/';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 600;
$config['sess_regenerate_destroy'] = FALSE;
#1
You can use:
您可以使用:
$r = implode('/', array_slice(explode('/', $_SERVER["SCRIPT_FILENAME"]),0,-1));
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'my_session';
$config['sess_expiration'] = 14400;
$config['sess_save_path'] = $r.'/session/';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 600;
$config['sess_regenerate_destroy'] = FALSE;