使用include('')插入PHP脚本;导致标头已发送错误

时间:2011-12-07 06:10:10

标签: php html

我正在尝试使用以下代码行将表单脚本插入到我的主页index.php中。

<?php include('email-system/index.php'); ?> 

并继续获取以下两条错误消息。表单显示,但是当我尝试使用include语句将脚本插入我的主页时,我经常会遇到此错误。我在很多不同的地方读过它可能是白色空间。如果你去www.mysite.com/email-system/index.php文件工作正常我假设它不是空白区域。关于我的问题是什么以及如何插入代码并纠正错误的任何想法?先感谢您。

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/content/84/8661784/html/header.php:7) in /home/content/84/8661784/html/email-system/index.php on line 6

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/84/8661784/html/header.php:7) in /home/content/84/8661784/html/email-system/index.php on line 6

1 个答案:

答案 0 :(得分:1)

如果您在include语句之前echo输出,那么您将只能得到它。 在将输出发送给用户之前,请确保包含/加载所需内容。