Refresh the PHP buffer for your site acceleration, refresh the PHP buffer site
In the current PHP version of the default configuration, "Output buffering" is opened. The old version is not so, in the old version of PHP, the string at each time the output (through the Echo or print function), will trigger a send to the client browser action.
The introduction of "Output buffering" makes this process faster and more efficient. A buffer is actually an area in memory that can be thought of as a large string in memory. When there are characters to output in the program, the content to be output is appended to the buffer, which is used to replace the previous version of PHP directly output to the browser each time. When the buffer is "refreshed", it is then uniformly entered into the user's browser. The following scenarios cause a "refresh" operation of the buffer:
1, the implementation of the PHP program completed;
2, the size of the buffer exceeds the Output_buffering value set in the php.ini configuration file;
3. The flush () or 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:
Buffer Flushing in action
<?php//Force flush Buffer Flush () here;?>
The next step is to explain the effect of the above code:
When the browser receives the code from the Head section of the page, it can start downloading the resources included in the head section, such as the CSS file, the site collection icon (Favicon), and so on. The download of these contents can be synchronized with the time when the browser accepts the contents of the body segment.
How much can accelerate, need to adapt to local conditions. This depends on many objective conditions, including the response speed of the server, your page size, your CSS file size and number, whether the 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 very much hope that you will use this little technique on your website and follow the actual results. We look forward to your feedback.
http://www.bkjia.com/PHPjc/1060096.html www.bkjia.com true http://www.bkjia.com/PHPjc/1060096.html techarticle Refresh the PHP buffer for your site acceleration, refresh the PHP buffer site in the current PHP version of the default configuration, "Output buffering" is opened. The old version is not ...