【问题标题】:Using PHP - How do I combine an anchor tag and a GET variable in the redirect使用 PHP - 如何在重定向中组合锚标记和 GET 变量
【发布时间】:2013-06-03 03:19:00
【问题描述】:
I want to combine these:

header("Location: index.php?msg=1");
header("Location: index.php#go-hear");


To look something like this:
header("Location: index.php#go-hear?msg=1");

这可能吗? 换句话说,我正在使用 _GET 并发送一个案例来过滤 switch 语句。 但我也希望页面使用锚标记重定向到页面底部,而不是顶部。

【问题讨论】:

  • 锚点在最后,在任何已解析的变量之后
  • 哦,标头应该是完整的 URI,而不是相对的 URI
  • 您还应该在您的header('Location: '.$URL) 之后包含一个exit; 调用,否则PHP 的其余部分仍然会执行。

标签: php html get anchor


【解决方案1】:

试试header("Location: index.php?msg=1#go-hear");

【讨论】:

    猜你喜欢
    • 2014-06-09
    • 2020-11-15
    • 1970-01-01
    • 1970-01-01
    • 2014-02-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多