Determine whether the page or image has been compressed by gzip through php

jacklove
Release: 2023-04-01 15:20:01
Original
1511 people have browsed it

Use php to determine whether the page or image has been compressed by gzip

1. Use get_headers

Page content

'one','value'=>1), array('name'=>'two','value'=>2), array('name'=>'three','value'=>3) ); header('content-type:application/json');echo json_encode($data);?>
Copy after login

Use get_headers to determine whether to use gzip compression

Copy after login

Test results:
Whenob_gzhandleris added,trueis returned , return after deletionfalse

2. Use curl

Picture

Copy after login

Use curl to judge Whether to use gzip compression

Copy after login

Test results:
Whenob_gzhandleris added,trueis returned, and returned after deletionfalse

This article explains how to use PHP to determine whether a page or image has been compressed by gzip. For more related content, please pay attention to the PHP Chinese website.

Related recommendations:

HTML5 example of obtaining the current geographical location and displaying it on Baidu map

Through php Auto-increment id to create a unique number class

Explanation on PHP optimized page output, compatible with examples of search engine robot access

The above is the detailed content of Determine whether the page or image has been compressed by gzip through php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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
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!