【发布时间】:2013-01-15 02:50:12
【问题描述】:
可能重复:
Use case for output buffering as the correct solution to “headers already sent”
Headers already sent by PHP
为了避免“标头已发送”错误消息,我可以在 PHP 中的会话开始之前使用 obstart,如下所示:
// db information here
ob_start();
session_start();
这是在每个 PHP 项目中使用以避免“标头已发送错误”的好习惯,还是用于特殊情况?
【问题讨论】:
-
不,为了避免错误 - 只是在开始会话之前不要发送任何内容。在编程中(以及在生活中),解决问题的根源而不是后果是有意义的
标签: php