Hiii,
I want to compress output开发者_如何转开发 [excluding image only] using GZIP in PHP, how to do so for each type of files [PHP, CSS, JS, HTML] ? I know the code to work with PHP file only.Use mod_deflate module of Apache more info
http://httpd.apache.org/docs/2.0/mod/mod_deflate.html
http://betterexplained.com/articles/how-to-optimize-your-site-with-gzip-compression/
Place this line in your page before any headers or other output.
ob_start("ob_gzhandler");
And for other files you can serve them through php, this could be used if you have mod-rewrite, but no mod-deflate or mod-gzip
精彩评论