PHP- “headers already sent” error depending on output length?

后端 未结 2 852
后悔当初
后悔当初 2021-01-25 15:58

I have a script which outputs mysql cell data. The \"content\" cell contains text output, which is of varied length.

When the contents of the \"content\" cell are small

相关标签:
2条回答
  • 2021-01-25 16:15

    The "headers already send" warning means, you modify the http headers somewhere in your code after you send output to the Client(i.e. with echo, whitespaces, etc..).

    This warning itself has nothing to do with the content length.

    There are more methods, wich modify the headers:

    • header / header_remove
    • session_start / session_regenerate_id
    • setcookie / setrawcookie
    0 讨论(0)
  • 2021-01-25 16:26

    PHP will buffer output if you want it to. You can control this programmatically with ob_start(), etc. However, there is a further option to set output buffering on in php.ini.

    Setting output_buffering=on enables it, while setting output_buffering=4096 will set a limit to the buffer size. phpinfo() should tell you if this is enabled, and what the buffer size is.

    The PHP reference is here

    0 讨论(0)
提交回复
热议问题