PHP echo-ing content as page loads

后端 未结 1 1519
日久生厌
日久生厌 2020-12-20 20:33

So I\'m doing some experimenting with PHP/Apache. Let\'s say I have this code.

DIV 1
DIV 2
相关标签:
1条回答
  • 2020-12-20 20:58

    No it may be a setting in php.

    In you local server, output_buffering is enabled in your php.ini file.

    You can disable it by setting :

    output_buffering = off
    

    To Ensure that the content is sent to the browser each time a echo-like statement is used, add :

    implicit_flush = on
    

    You also can set the buffer size by giving output_buffering a value.

    output_buffering = 4096
    

    here the buffer size would be 4KB.

    Output buffering tells php to keep in memory all data to be sent to the browser until it encouters a flush() instruction in your code, the buffer happens to be full, or it is the end of the script.

    Here is the full reference for output buffer from php.net : php output buffer

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