$string = "8aeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeer8aaaaaaaaaaaaaaaaaaaaaaadasd456as d456asd456asd456asd456asd456asd456asd456asd456asd456asd456asd456fasdf45645645645645645 6456456456456456456456456456456456456456456456456456456456456456456456456a56fs4s4s4s4s 4s4s4s4s4s4s4s4s4s4dsdga133333333333333333333w8etw7q9999999999999999999a23s1dfffffffff fffffffffffffffa456ssssssssssssdv2sdddddddddddddddddddf"; echo "字符串长度:"; echo strlen($xx); echo "gzcompress压缩后长度 :"; echo strlen(gzcompress($string,9)); echo "gzencode压缩后长度:"; echo strlen(gzencode($string,9)); echo "gzdeflate压缩后长度:"; echo strlen(gzdeflate($string,9));运行结果是: 字符串长度:388 gzcompress压缩后长度 :80 gzencode压缩后长度 :92 gzdeflate压缩后长度 :74 由此可见,这三个函数按照压缩效果进行排序:gzdeflate、gzcompress、gzencode,gzdeflate压缩效果最好,gzcompress次之,gzencode最差。 分析: 查了下手册,gzcompress、gzencode、gzdeflate这三个函数,分别采用的是zlib、gzip、DEFLATE方式压缩格式。通过上面的运行结果,不知道是否可以这么认为,DEFLATE、zlib、gzip的压缩效果递减