Python CGI 事务
我有一个Python CGI 处理支付交易。当用户提交表单时,CGI 被调用。提交后,CGI 需要一段时间才能执行信用卡交易。在此期间,用户可能会按下 ESC 或刷新按钮。这样做不会“杀死”CGI,这意味着脚本将继续运行以完成事务,但 CGI 的 HTML 输出将永远不会到达客户端。这意味着用户将不知道交易已完成。我该如何解决这个问题?
I have a Python CGI handling a payment transaction. When the user submits the form, the CGI is called. After submission, the CGI takes a while to perform the credit card transaction. During that time, a user might hit the ESC or refresh button. Doing that will not "kill" the CGI, meaning, the script will keep running completing the transaction but the CGI's HTML output will never reach the client. This means the user will not know the transaction was completed. How can I solve this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
与您对每个 POST 所做的操作相同:不发送输出,而是将输出放入会话变量中并重定向到纯 GET 请求。这个在会话中查找消息,并清除+显示这些消息。
Same as you should do with every POST: don't send output, but put the output in a session variable and redirect to a pure-GET request. This one looks in the session for messages, and clears+displays those.