The buffer actually opens up a region in the memory and can be considered as a large string in the memory. When the program has characters to output, the content to be output will be appended to the buffer.
The buffer actually opens up a region in the memory and can be considered as a large string in the memory. When there are characters in the program to be output, the content to be output will be appended to the buffer, used to replace the previous version of PHP to directly output to the browser every time. When the buffer zone is refreshed, it is uniformly input to the user's browser. In the following situations, the buffer will be refreshed:
- PHP program execution is complete;
- The cache size exceeds the output_buffering value set in the php. ini configuration file;
- When the flush () or ob_flush () function is called.
We can refresh the PHP buffer immediately after the head tag to accelerate your site. the sample code is as follows:
Buffer flushing in action
For WordPress, similar code can be put in the header. php file of the WordPress template.
The role of the above code:
When the browser receives code from the head part of the page, it can start to download the resources included in the head segment, such as CSS files and site favorites icons (Favicon. The download of the content can be synchronized with the time when the browser accepts the content of the body segment.
The specific amount of acceleration needs to be tailored to local conditions. This depends on many objective conditions, including the server's response speed, your page size, your CSS file size and quantity, and whether the browser has a local cache.