Accelerate Your page-data compression. Recently, even websites are getting slower and slower, not because the script execution time is slow, but the network transmission speed is slow. I know that http1.1 supports gzip-encoded data, so try to compress your page... (recently, my website is getting slower and slower, not because of slow script execution, but network transmission speed.
I know that http1.1 supports gzip encoding data, so try to compress your page...
(You can set it in php. ini and output it as gzip code directly, but you have not tried it)
I found a gzdoc. php on the Internet and changed it so that everyone could think about it.
Ob_start (); // enable the output buffer.
Ob_implicit_flush (0 );//
//************************************** ***************************//
// Function name: canGzip ()
// Purpose: Check whether the client browser supports gzip and x-gzip encoding.
// Parameters:
// Return value: Supported encoding types: "gzip" and "x-gzip". false indicates not supported.
//************************************** ***************************//
Function canGzip ()
{
// If (headers_sent () | connection_status)
// Return false;
If (strpos ('King'. $ _ SERVER ["HTTP_ACCEPT_ENCODING"], 'gzip ')! = False)
Return "gzip ";
If (strpos ('King'. $ _ SERVER ["HTTP_ACCEPT_ENCODING"], 'X-gzip ')! = False)
Return "x-gzip ";
Return false;
}
//************************************** ***************************//
// Function name: doGzipOut ($ level, $ debug)
// Function: compress and output the buffered data.
// Parameter: $ level indicates the compression level, 0 = no compression, 9 = maximum compression rate
// $ Debug indicates whether to output debugging information. 1 = output, 0 = no output.
// Return value:
//************************************** ***************************//
Function doGzipOut ($ level = 1, $ debug = 0)
{
$ ENCODING = canGzip ();
If ($ ENCODING)
{
Echo "n N ";
$ Contents = ob_get_contents ();
Bytes. Http1.1 supports gzip data, so try to compress your page...