定时器会话超时

发布于 2024-08-21 00:52:22 字数 125 浏览 3 评论 0原文

我想用计时器使会话超时, 我正在实现一个电子商务项目,当用户在购物车中添加第一个产品时,我需要启动计时器,并且用户在购物车中添加更多产品,但用户没有在特定时间内结帐购物车产品,购物车会话超时(购物车为空) )。 怎样才能达到这个目的呢。

I want to time out the session with timer,
I am implementing a ecommerce project, where I required when user add first product in the cart a timer will start and user add more products in the cart but user did not checkout the cart product within a specific time the cart session is timeout(cart empty).
How can acchive this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

爱你不解释 2024-08-28 00:52:22

你为什么要这样做?不要使用会话,而是将购物车详细信息存储在数据库中。这样他们就可以明天(或当天下午晚些时候)回来并退房。

大多数大型电子商务网站永远不会清除您的购物车。出于充分的理由,用户实际上可能会回来完成该过程。

Why would you do this? Instead of using session, store their cart details in the database. That way they can come back tomorrow ( or later that afternoon ) and check out.

Most of the big eCommerce sites never clear your cart. For the very good reason that users might actually come back to complete the process.

北城半夏 2024-08-28 00:52:22

实际回答这个问题:
在服务器端,当产品添加到购物车时,请保存日期时间戳。

每当加载任何页面时,请检查日期时间戳。如果超过了您的可接受点,只需删除购物车数据即可。

To actually answer the question:
On server side, when a product is added to the cart save the date time stamp with it.

Whenever any page is loaded, check the date time stamp. If it is passed your acceptable point, simply delete the cart data.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文