[英]CodeIgniter with Ion AUTH login not remembered
I'm working on CodeIgniter login with ION auth plugin. 我正在使用ION auth插件进行CodeIgniter登录。 I don't know why, but I have this behavior: I fill login form, send it, user is matched, CI save this data into "user_data" column in default_ci_sessions table and I reload page and user is still not logged in and in table default_ci_sessions is created new row with empty "user_data" column. 我不知道为什么,但我有这样的行为:我填写登录表单,发送它,用户匹配,CI将此数据保存到default_ci_sessions表中的“user_data”列,我重新加载页面,用户仍然没有登录并且在table default_ci_sessions创建了一个空行“user_data”列的新行。 Do you know, where might be problem? 你知道吗,哪里可能有问题? Here is my config for sessions: 这是我的会话配置:
$config['sess_cookie_name'] = 'pyrocms' . (ENVIRONMENT !== 'production' ? '_' . ENVIRONMENT : '');
$config['sess_expiration'] = 0;
$config['sess_expire_on_close'] = TRUE;
$config['sess_encrypt_cookie'] = TRUE;
$config['sess_use_database'] = TRUE;
// don't change anything but the 'ci_sessions' part of this. The MSM depends on the 'default_' prefix
$config['sess_table_name'] = 'default_ci_sessions';
$config['sess_match_ip'] = TRUE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
Solved. 解决了。 I need to set cookie settings to this: 我需要为此设置cookie设置:
$config['cookie_prefix'] = "";
$config['cookie_domain'] = "";
$config['cookie_path'] = "";
I can see that you answered the problem yourself, but to add a solution to make it easier to find for others with the same problem, I have added it here with some more explanation for why it is the solution. 我可以看到你自己解决了这个问题,但是为了添加一个解决方案以便更容易找到具有相同问题的其他人,我在这里添加了一些解释,为什么它是解决方案。
Your Full code: 您的完整代码:
$config['sess_cookie_name'] = 'pyrocms' . (ENVIRONMENT !== 'production' ? '_' . ENVIRONMENT : '');
$config['sess_expiration'] = 0;
$config['sess_expire_on_close'] = TRUE;
$config['sess_encrypt_cookie'] = TRUE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'default_ci_sessions';
$config['sess_match_ip'] = TRUE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
//Added code to fix issue
$config['cookie_prefix'] = "";
$config['cookie_domain'] = "";
$config['cookie_path'] = "/";
$config['cookie_prefix']
Sets a prefix if you need to avoid collisions $config['cookie_prefix']
如果需要避免冲突,请设置前缀 $config['cookie_domain'];
Set to .your-domain.com for site-wide cookies 设置为.your-domain.com以获取站点范围的Cookie $config['cookie_path'];
Typically will be a forward slash 通常会是正斜杠 setting each equal to "" pretty much makes sure that cookies are set for the entire domain. 设置每个等于“”几乎确保为整个域设置cookie。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.