压缩字符串:
base64_encode(gzcompress(serialize($data)))
解压字符串:
unserialize(gzuncompress(base64_decode($search_cache['data'])));
判断是否是base64:
function is_base64($str) {
return $str == base64_encode(base64_decode($str)) ? true : false;
}
经测试,每100个汉字,经过压缩变为32字节,不压缩为300字节