Home >Backend Development >PHP Tutorial >http://zikao.hneao.cn/net/ An example of Gzip compression transmission method in HTTP mode in PHP
Gzip compression transmission can more effectively save bandwidth traffic. He first compresses the text into .gz and then transmits it to the browser. Finally, the browser is responsible for decompressing and presenting it to the user.
Older versions of browsers may not be able to display it, but most browsers now can display it.
Enabling Gzip transmission first requires PHP 4.0.5 or later.
Method 1:
Add
php_flag zlib.output_compression on
php_value zlib.output_compression_level 2 in .htaccess
Method 2:
Add
ob_start("ob_gzhandler");
Both methods can achieve compression transmission effect.
Check here whether your website is compressed
How to GZIP compress HTML?
This is very simple: first make the HTML into PHP, and then rewrite the html in .htaccess.
The above has introduced the Gzip compression transmission method in HTTP mode in PHP, including the content of http://zikao.hneao.cn/net/. I hope to have a better understanding of PHP. Tutorials are helpful for those who are interested.