作者TEMU2000 (skystar)
看板PHP
標題[請益] 重複寫入標頭錯誤
時間Thu May 5 18:19:40 2011
原始碼:
<?php
ob_start();
setcookie("test","test");
ob_end_flush();
?>
<html>
</html>
執行結果:
Warning: Cannot modify header information - headers already sent by (output
started at D:\AppServ\www\fhsh\test.php:1) in D:\AppServ\www\fhsh\test.php on
line 3
環境是app-serv 2.5.10
我把setcookie放在<html>標籤前面仍然會發生重複寫入標頭錯誤
即使使用ob_start()函式開啟緩衝區也沒有作用
請問為何會發生這種問題呢?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 125.228.171.17
1F:→ arrack:bom 05/05 18:31
2F:→ TEMU2000:感謝1F解答,查了一下資料才知道原因@@ 05/05 23:11
※ 編輯: TEMU2000 來自: 125.228.171.17 (05/05 23:18)