【问题标题】:Why does this script work in Firefox but not in IE9?为什么这个脚本可以在 Firefox 中运行,但不能在 IE9 中运行?
【发布时间】:2012-02-14 10:30:40
【问题描述】:
$URL="http://www.villagestone.co.za/mailsendfail.html";
print "<meta http-equiv=\"refresh\" content=\"1;$URL\">";

【问题讨论】:

  • 这是你的全部剧本吗?你想让它做什么?
  • 将您的代码重写为纯 HTML,对其进行测试,如果问题仍然存在,请在适当的标签下发布您的问题。 PHP与浏览器无关。
  • 非常低质量的问题。描述“不起作用”一词(您的预期结果及其行为方式)。 php 生成的 HTML 输出是什么?你把这个 标签放在哪里?

标签: php firefox internet-explorer-9


【解决方案1】:

啊,现在我明白了。试试这个:

$URL = "http://www.villagestone.co.za/mailsendfail.html";
print "<meta http-equiv=\"refresh\" content=\"1;URL=$URL\">";

IE 需要 'URL=' 前缀,这就是它在 Firefox 而不是 IE 中工作的原因。

【讨论】:

    【解决方案2】:

    最好通过header 函数重定向

    header('Location: '.$URL);
    

    注意:此行必须出现在任何文本输出之前。

    阅读更多:http://php.about.com/od/learnphp/ht/phpredirection.htm

    【讨论】:

      【解决方案3】:

      如果你有干净的字符串,你最好使用'' like:

      $URL = 'http://www.villagestone.co.za/mailsendfail.html';
      print '<meta http-equiv="refresh" content="1;url=' . $URL . '">';
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-01-01
        • 1970-01-01
        • 2018-02-05
        • 1970-01-01
        相关资源
        最近更新 更多