Gzip compression transmission method in HTTP mode in PHP_PHP tutorial

WBOY
Release: 2016-07-21 15:57:09
Original
854 people have browsed it

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.

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_level2 in .htaccess


Method 2 :

Add

ob_start("ob_gzhandler");


to the top of the php head. Both methods can achieve the effect of compressed transmission.

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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/317904.htmlTechArticleGzip 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...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!