2009-01-12 84 views
4

即时通讯设法建立一个会话,我得到一个头错误,尽管我可以告诉我告诉它在发送头之前开始会话。这里的任何帮助将是有用的。PHP:不能发送会话cookie错误

<?php 
ob_start(); 
session_start(); 
$_SESSION['active'] = 1; 
ob_end_flush(); 
?> 
<html> 
<body> 
2009c Christ Redeemer Catholic Church 
</body> 
</html> 

警告:在session_start()[function.session启动]:不能发送会话cookie - 已经由(输出开始/家庭/内容/ K/U/R/kuriomister/HTML/TEMP发送了头/教会/ index.php:1)in /home/content/k/u/r/kuriomister/html/temp/church/index.php on line 3

Warning:session_start()[function.session-start] :无法发送会话缓存限制器 - 已在/ home/content/k/u/r中发送的头文件(输出开始于/home/content/k/u/r/kuriomister/html/temp/church/index.php:1) /kuriomister/html/temp/church/index.php on line 3

回答

9

如果您使用UTF-8,请务必保存文件,而不要使用BOM

+0

谢谢,那是关键。 – user54229 2009-01-12 16:50:31

3

查看输出:Cannot send session cookie - headers already sent by (output started at /home/content/k/u/r/kuriomister/html/temp/church/index.php:1)。 您似乎在文件的开头有一些空格(空格,制表符,换行符......)。