<?php
在没有看到完整代码的情况下,您可能在标签、HTML 或其他类型的“输出”之外或上方有空格,甚至可能是字节顺序标记。
<?php
echo "Correct";
// or vvv, but not with echo
// header("Location: http://www.example.com/");
?>
被视为“输出”的示例(在标题之前):
(space)
(space) <?php
echo "Incorrect";
header("Location: http://www.example.com/");
?>
<div align="center">Text</div> <!-- HTML -->
<!-- comment tags also considered as output -->
<?php
echo "Incorrect";
header("Location: http://www.example.com/");
?>
(byte order mark) // aka BOM which is invisible but still present
<?php
echo "Incorrect";
header("Location: http://www.example.com/");
?>
有关该header()
功能的更多信息,请访问 PHP.net 网站: