header() error not shown in php

后端 未结 3 1694
伪装坚强ぢ
伪装坚强ぢ 2021-01-27 12:20

I wrote a PHP program, I use session_start() and header() functions, I know I should use this functions before I sending anything to client. it\'s ok,

3条回答
  •  太阳男子
    2021-01-27 13:09

    This might be possible because you write into an output buffer (ob_start) which doesn't actually return anything to the client until you explicitly flush the buffer (ob_flush or ob_end_*) or the script ends.

    The fact that you can't send headers after you begun writing the body part of your HTTP response is not a php but a HTTP protocol limitation, so this cannot be version specific either.

    Many frameworks like the Zend Framework use output buffers so a developer doesn't need to care about the order.

提交回复
热议问题