本文介绍了标题刷新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  if(strlen($ _ POST ['reply'])< 6){
header(Refresh:2; url = thread.php?id = $ tid #回复);
die(您输入的文本太短,请写出更长的文本,然后重试。);
}

当我添加 #reply ?给出一个空白页面。它虽然与标题位置一起工作。任何想法?

解决方案

哈希符号(#)后的任何内容都是URL的本地部分,不应强制刷新。另外,如果您在浏览器中使用#reply并在地址栏中再次按回车,则页面不会刷新,您将被带到页面的#reply部分(目标)。



另外请注意,由于不使用完整网址,因此违反了标准。您应该使用:
url = http://server.com/thread.php? PS:我会推荐使用 Header(Location:xxxxxxxx);
,您应该在META标记中放入刷新


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.");
}

Why won't header refresh work when I add #reply? Gives a blank page. It works with header location though. Any idea?

解决方案

anything after hash sign (#) is a local part of the URL and shouldn't force refresh. Also, if you have #reply in the URL in browser and press enter again in address bar, the page is not refreshed, you are just taken to the #reply part (target) of the page.

Also note, you are breaking standards by not using full URL. You should be using:url=http://server.com/thread.php?id=$tid#reply

PS: I would recommend using Header("Location: xxxxxxxx");you should put refresh in the META tag

这篇关于标题刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 01:52