【问题标题】:HTML with Perl script not returning to main page带有 Perl 脚本的 HTML 不返回主页
【发布时间】:2014-04-09 05:46:28
【问题描述】:

我从 HTML 文件 (index.html) 中的表单调用 perl 脚本。

<form method="post" action="cgi-bin/test.pl">
  more cmds....
   <input type="submit" align="left" value="Submit">   
</form>

perl 脚本成功执行。但它仍保留在test.pl

它不会返回到index.html。在 perl 脚本之后还有很多操作要做。

如何将执行指针返回到index.html

【问题讨论】:

  • 您的脚本应该重定向到 html 页面(通过 javascript/header/meta 标签)。顺便说一句,这是一种古老的方法,甚至早于上世纪末的整个 cgi 浪潮。

标签: javascript html perl


【解决方案1】:

CGI #Generating a Redirection Header

print CGI->redirect('http://somewhere.else/in/movie/land');

或者使用javascript的window.location重定向

print CGI->header() . qq{
<html>
<head>
<script>
window.location.assign("http://somewhere.else/in/movie/land")
</script>
</head>
<body>
<p>redirecting...</p>
</body>
</html>};

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-08-02
    • 1970-01-01
    • 2020-06-26
    • 2016-07-03
    • 1970-01-01
    • 2012-01-02
    • 2015-03-15
    相关资源
    最近更新 更多