简体   繁体   English

如何在PHP中以及互联网断开后如何长时间保持会话详细信息

[英]How to keep session details alive for long time in PHP and when internet is gone

For an Online exam application using PHP,JS,MySql, I have an exam that has 3 Hours. 对于使用PHP,JS,MySql的在线考试应用程序,我的考试时间为3小时。 All the questions are loaded in client side and after the time-out/submit only-we communicate with server for valuation of exam and results. 所有问题均加载到客户端,并且仅在超时/提交之后—我们与服务器进行通信以评估考试和结果。 When internet is gone for Some Hours/Time i cant calculate the exam results and i am losting my attended exam details for valuation. 当互联网消失了几个小时/一段时间后,我无法计算考试结果,并且我丢失了参加考试的详细信息以进行评估。

How I understand, your problem is PHPSESSION expiration (because PHP drop session after 30 minutes). 据我了解,您的问题是PHPSESSION到期(因为30分钟后PHP删除会话)。 So I recommend store your session data into database and make session cookie expiration time ~3 hours (exam time). 因此,我建议将您的会话数据存储到数据库中,并使会话Cookie的有效时间约为3小时(考试时间)。

Also you can make PHP SESSION live time more long ( How do I expire a PHP session after 30 minutes? ). 另外,您还可以延长PHP SESSION的生存时间( 如何在30分钟后使PHP会话到期? )。 But i think more right way - store all data in database 但是我认为更正确的方法-将所有数据存储在数据库中

互联网消失时 ,我们可能还是被搞砸了...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM