Use php to determine whether the page or image has been compressed by gzip
Page content
'one','value'=>1), array('name'=>'two','value'=>2), array('name'=>'three','value'=>3) ); header('content-type:application/json');echo json_encode($data);?>
Use get_headers to determine whether to use gzip compression
Test results:
Whenob_gzhandleris added,trueis returned , return after deletionfalse
2. Use curl
Picture
Use curl to judge Whether to use gzip compression
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!