Home >php教程 >PHP源码 >开启gzip压缩网站内容

开启gzip压缩网站内容

PHP中文网
PHP中文网Original
2016-05-25 17:10:261190browse


SetOutputFilter DEFLATE
    # Don’t compress images and other
    SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI .(?:pdf|doc)$ no-gzip dont-vary
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css 
    AddOutputFilterByType DEFLATE application/javascript

                       

           

2. [代码][PHP]代码    

在php文件中写入
ob_start('ob_gzhandler');

           

       

Statement:
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