gpt4 book ai didi

PHP header Location 在 HTML 中间工作

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:07:11 26 4
gpt4 key购买 nike

我在理解 header("Location: http://www.google.com/"); 的方式时遇到问题可以在 HTML 页面的中间工作 <body> .
由于 HTML 输出标题已经发送,在 <?php ... ?> 之前,不应该出现错误吗?部分开始。

我指的是警告 Cannot modify header information - headers already sent by...我希望得到。

我正在本地 PHP 开发环境 (Apache/2.2.15 (Win32) PHP/5.3.2) 上测试它。

这是一个例子:

<html>
<head>
</head>
<body>
<?php header("Location: http://www.google.com/"); ?>
</body>
</html>

有什么想法吗?谢谢。

最佳答案

是因为output buffering ...

关于PHP header Location 在 HTML 中间工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3037199/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com