PHP 5.4 之后新增的 gzip 解压函数 gzdecode 使用方法,gzdecode — Decodes a gzip compressed string,解压一个使用 gzip 压缩的字符串,这是官网手册上面写到的。
目前很多的空间服务商的 PHP 版本都没有达到 5.4 ,这也导致使用此函数之后发生函数未定义错误,该如何解决这个问题呢?PHP 官方网站用户提交的日志中有人给出了很好的解决方案,使用 gzinflate 函数代替,代码参考如下:
<?phpif (!function_exists('gzdecode')) { function gzdecode($data) { return gzinflate(substr($data,10,-8)); } }