作者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)