sess_expire_on_close不工作 [英] sess_expire_on_close not working
问题描述
我有一个问题。 $ config ['sess_expire_on_close'] = TRUE;
当我关闭浏览器。会话仍保存在数据库。
和i仍然可以看到 user_data
列中的数据。
I have a problem..in $config['sess_expire_on_close'] = TRUE;
when i close the browser..the session still save in the database.
and i can still see the data in user_data
column.
config.php
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 2400;
$config['sess_expire_on_close'] = TRUE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
需要帮助..
目的是显示所有在线用户。
Need help.. the purpose is to show all online users.
我使用CI版本2.1.3
I'm using CI version 2.1.3
推荐答案
服务器从来不知道用户关闭他们的浏览器。 'sess_expire_on_close'关注当浏览器重新启动时,用户的cookie是否将被写入和重用。
The server never knows about the user closing their browser. 'sess_expire_on_close' regards whether the user's cookie will be written and re-used when the browser is restarted.
要检测并结束会话,您必须执行此问题中列出的检查:
javascript检测浏览器关闭标签页/关闭浏览器
To detect and end session, you'd have to perform a check like outlined in this question: javascript detect browser close tab/close browser
执行
$this->session->sess_destroy();
在 codeigniter 。
这篇关于sess_expire_on_close不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!