PHP 对字符串进行压缩和解压

$str = 'Compress meCompress meCompress meCompress meCompress meCompress meCompress meCompress meCompress me';

echo "str".strlen($str)."/n";

//压缩率最低
$gzencode = gzencode($str,9);
echo "gzencode".strlen($gzencode)."/n";

//压缩率居中
$gzcompress = gzcompress($str,9);
echo "gzcompress".strlen($gzcompress)."/n";

//压缩率并列最高
$gzdeflate = gzdeflate($str,9);
echo "gzdeflate".strlen($gzdeflate)."/n";

//压缩率并列最高
$bzcompress = bzcompress($str,9);
echo "bzcompress".strlen($gzdeflate)."/n";

解压缩

gzinflate()

这个函数负责解压gzdeflate()函数的压缩字符串

你可能感兴趣的:(PHP)