In the current PHP version of the default configuration, "Output buffer (buffering)" is opened. This is not the case in older versions of PHP, where strings are emitted every time it is output (via the Echo or print function), triggering an action sent to the client browser at a time.
The introduction of "Output buffering" makes the process faster and more efficient. The buffer actually opens up an area in memory and can be thought of as a large string in memory. When a program has characters to output, the content to be output is appended to the buffer to replace the old version of PHP, which is directly exported to the browser each time. When the buffer is "refreshed", it is then unified into the user's browser. The following situations cause a "refresh" operation on the buffer:
1, PHP program execution completed;
2. The buffer size exceeds the output_buffering value set in the php.ini configuration file;
3, flush () or the Ob_flush () function is called.
in the actual product environment, we can speed up your site by refreshing the PHP buffer immediately after the head tag, the sample code is as follows:
Next, explain the effect of this code:
when the browser receives the code in the Head section of the page, you can start downloading the resources included in the head section, like CSS files, site Favorites icons (Favicon), and so on. These downloads can be synchronized with the time the browser accepts the contents of the body section.
Concrete can accelerate how much, need to local conditions. This depends on a number of objective conditions, including the response speed of the server, your page size, the size and number of your CSS files, whether your browser has a local cache, and so on. There are many factors, but such a small optimization, it can be obvious for your site acceleration, why not?
I really want you to use this tip on your website and keep track of the actual results. We look forward to your feedback.