Home  >  Article  >  Backend Development  >  http://zikao.hneao.cn/net/ An example of Gzip compression transmission method in HTTP mode in PHP

http://zikao.hneao.cn/net/ An example of Gzip compression transmission method in HTTP mode in PHP

WBOY
WBOYOriginal
2016-07-29 08:36:231104browse

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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn