2014-03-25 33 views
-1

我正在准备一个类来介绍PHP。那么当我想展示如何标头失败时,它不会失败并正常工作。php标题不会失败

例如:

<hr> 
    <?php header('Location: http://www.google.com'); ?> 

的例子有效地重定向到谷歌。

为什么会这样?

我试过使用Firefox,Opera和IE。

谢谢!

编辑:

添加ob_end_flush()函数的警告出现。

+1

'ob_end_flush()函数'之前,你的头调用应该提高预警 –

+2

听起来像是你有启用输出缓冲。 –

回答

0

您可以使用HTML标签

<meta http-equiv="refresh" content="0; http://google.com" />