本文章给大家介绍一个php检测服务器是否支持gzip代码,有需要了解的朋友不防进入参考。
检测是否支持gzip 是可以利用function_exists函数来判断你的php环境支持ob_gzhandler不,如果支持就支持者gzip了。
自己写了一个函数
代码如下 | 复制代码 |
if(extension_loaded('zlib')) {ob_start('ob_gzhandler');} |
还一种办法就是直接利用,然后再看看是不是开启了gzip了,或直接利用相关的站长工具了
下面我来介绍一个PHP实现gzip页面压缩
代码如下 | 复制代码 |
if(Extension_Loaded('zlib')) Ob_Start('ob_gzhandler'); for($i=0;$iecho 'Hello World!'; } ?> if(Extension_Loaded('zlib')) Ob_End_Flush(); ?> |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Dreamweaver Mac version
Visual web development tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.
