问题描述
我一直在寻找PHP或JavaScript解决方案来做这件事。
I have been looking all day for a PHP or JavaScript solution to do this.
我想提醒用户他们的会话即将超时(弹出窗口) ),能够延长会话时间。
I would like to alert the user their session is about to time out (popup), ability to extend the session time.
如果你需要一个视频,你可以在
Here is a visual if you need one on this page
编辑:
如果有帮助,jQuery就是框架
jQuery is the framework if that helps
推荐答案
这相对容易:
-
使用
拥有 setTimeout
函数显示确认对话框,例如使用
Have the setTimeout
function show a confirmation dialog, e.g. using jQuery UI Dialog
如果用户想要延长会话,请向PHP文件发出Ajax请求。如果文件使用会话,这将触摸会话的生命周期
If the user wants to prolong the session, make an Ajax request to an PHP file. If the file uses sessions, this will work to "touch" the session's lifetime
发出请求后,设置另一个 setTimeout
将在会话即将到期时触发。
After making the request, set another setTimeout
that will fire when the session is about to expire again.
这篇关于如果会话即将到期,则提醒用户,续订会话的选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!