[請益] 重複寫入標頭錯誤

看板PHP作者 (skystar)時間13年前 (2011/05/05 18:19), 編輯推噓0(002)
留言2則, 2人參與, 最新討論串1/1
原始碼: <?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

05/05 18:31, , 1F
bom
05/05 18:31, 1F

05/05 23:11, , 2F
感謝1F解答,查了一下資料才知道原因@@
05/05 23:11, 2F
※ 編輯: TEMU2000 來自: 125.228.171.17 (05/05 23:18)
文章代碼(AID): #1Dmdc-45 (PHP)