«
»
http1.1支持gzip编码的数据,所以,通过GZIP来实现页面压缩。在PHP中,我所知道的有两种方法使用GZIP,一种是PHP自带的,不过,要你所用的服务器支持才行!还有一种,呵呵,从网上搜索来的,在这儿就献给大家了。
<?php
ob_start();//打开输出缓冲
ob_implicit_flush(0);//
//*****************************************************************//
//函数名:canGzip()
//作用:检查客户浏览器是否支持gzip,x-gzip编码
//参数:
//返回值:支持的编码类型"gzip", "x-gzip", 返回false代表不支持
//*****************************************************************//
function canGzip()
{
//if (headers_sent() || connection_status)
//return false;
if (strpos('King'.