2009-01-12 114 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)。 您似乎在文件的開頭有一些空格(空格,製表符,換行符......)。