5
if (strlen($_POST['reply']) < 6) {
header("Refresh: 2; url=thread.php?id=$tid#reply");
die("The text you have entered is too short. Please write a longer text and try again.");
}

当我添加#reply时,为什么标题刷新不起作用?给出一个空白页。它适用于标题位置。任何想法?

4

1 回答 1

6

井号 (#) 之后的任何内容都是 URL 的本地部分,不应强制刷新。此外,如果您在浏览器的 URL 中有 #reply 并在地址栏中再次按 enter,则页面不会刷新,您只会被带到页面的 #reply 部分(目标)。

另请注意,您不使用完整的 URL 违反了标准。您应该使用: url= http://server.com/thread.php?id= $tid#reply

PS:我建议使用Header("Location: xxxxxxxx"); 你应该把刷新放在 META 标签中

于 2009-02-16T21:36:04.560 回答