如何在Php标题之前回显一些东西?

时间:2015-04-28 08:39:32

标签: php header url-redirection

我有一个代码可以重定向到带有标题的网址,如

header("Location: $reponseUrl"); 

但我希望在重定向之前回应一些事情,比如

echo "some text here"; 
header("Location: $reponseUrl"); 

但输出就像

headers already sent by (output started at..)..

最后我找到了解决方案

必须做这样的事情

header("Refresh: 5; url=$reponseUrl");
echo 'some text here'; 

这将回显5秒然后它将重定向。

0 个答案:

没有答案