gzip's tag archives

ThinkPHP中实现gzip压缩

ThinkPHP中似乎没有对gzip的配置选项。不过实现起来还是挺简单的。以下是对 ThinkPHP 2.1 的修改方法。 首先要确定空间是否支持Zlib, 然后找ThinkPHP的控制输出函数output()。 控制输出的文件在 ThinkPHP/Lib/Think/Core 文件夹下,文件名 View.class.php。 [code] /** +---------------------------------------------------------- * 输出模板 +---------------------------------------------------------- * @access protected +---------------------------------------------------------- * @param string $content 模板内容 * @param boolean $display 是否直接显示...

How to use Gzip to load your site faster in 5 minutes

This tutorial will only examine one particular way of implementing Gzip compression with PHP, but there is another way to accomplish it with Apache if you have administration access to your server. Step 1: Enable zlib compression in php. You can do this many ways, just choose one: * Add a line to your .htaccess file: [code]php_flag zlib.output_compression On[/code] * Add or change a line in your php.ini file: [code] output_buffering = Off output_handler = zlib.output_compres...