-1

可能重复:
已由 PHP
参考发送的标头 - 此错误在 PHP 中意味着什么?

<?php
include 'connect.php';
include 'header.php';
?>      
<p>Mahtava is an organization dedicated to providing great services and web projects to people for free. We are passionate about the web and making it a better place for its citizens to live in. We have a strong emphasis on the user experience in whatever we do, and are focussed on keeping things the best for our users. Many of our projects are open source, and we always are inviting new developers to help with them or to develop projects of their own with us.</p>
<?php
include 'footer.php';
?>

上面的代码有什么问题?它不断地给我

'警告:session_start() [function.session-start]:无法发送会话缓存限制器 - 标头已发送(输出开始于 /home/u599980382/public_html/newsite/index.php:1)在 /home/u599980382/public_html/ newsite/connect.php 在第 2 行'。

它不会在任何其他页面上执行此操作,即使是具有几乎完全相同的代码的页面(只是内容不同);它只在索引上执行此操作。提前感谢您提供的任何帮助。

4

1 回答 1

0

使用标头功能标头尚未发送,您可以通过 headers_sent 检查它

// If no headers are sent, send one
if (!headers_sent()) {
......
}

您可以将代码更改为这种情况:

<?php
include 'header.php';
include 'connect.php';
include 'content.php';
?>
于 2013-01-05T05:26:20.953 回答