如何在 CGIAr 中重定向到 Python 中的另一个页面
如果我想使用以下核心库将用户从 cgi 脚本重定向到 HTML 页面:
import cgi
请有人为我指出正确的方向。而已。只需从 cgi 脚本重定向到 html 页面即可。你会怎么做这个Python。如果您必须物理地写出 HTTP 响应标头才能实现此目的,那么我将不胜感激有关如何执行此操作的任何信息。 蒂亚·
安德鲁
If I want to redirect the user from a cgi script to a HTML page using core libraries from the following:
import cgi
Please could someone point me in the right direction. Nothing more. Simply redirect from cgi script to html page. How ever you would do this Python. If you have to physically write out the HTTP Response Headers to achieve this, then I would appreciate any info on how to do this.
TIA
Andrew
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
除了
Location
之外,您还需要输出一个标头(“Status”),例如:You need to output one more header ("Status") in addition to the
Location
one, e.g.:使用位置标头进行重定向
要记住的一点是位置标头应写在任何其他打印语句之前。如果在其之前编写其他打印语句,则位置标头将像平常一样打印在屏幕上文本。
To redirect use Location header
One point to remember is that location header should be written before any other print statements.If other print statements are written before it then the loaction header will be printed in the screen just as normal text.