Home > Backend Development > PHP Tutorial > Use PHP to determine whether the server supports Gzip compression function_PHP tutorial

Use PHP to determine whether the server supports Gzip compression function_PHP tutorial

WBOY
Release: 2016-07-21 16:13:05
Original
989 people have browsed it

Gzip can compress the size of web pages to accelerate the speed of opening web pages. Almost all current mainstream browsers support this function, but turning on Gzip requires server support. Here we simply use php to determine whether the server supports the Gzip function.

Create a new php type file, which can be named test.php. Write the following code in the file:

Copy code Code As follows:



Then save and upload it to the root directory of the space you need to test. After uploading, Open the URL of this file in the browser:

http://your domain name and directory/test.php, for example, this site is: http://3aj.cn/test.php

After opening the page, CTRL+F searches for the following string:
_SERVER["HTTP_ACCEPT_ENCODING"]
After finding it, check to see if there is a gzip parameter in the back. If so, congratulations, your space supports Gzip. If not, unfortunately, this means that your website cannot use Gzip compression.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/313578.htmlTechArticleGzip can compress the size of web pages to speed up the speed of opening web pages. Almost all current mainstream browsers support this function. But turning on Gzip requires server support. Here we simply...
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