PHP decompression function Gzdecode and gzinflate use method

Source: Internet
Author: User
PHP decompression function Gzdecode and gzinflate use method Technology

Maybe yes posted on 2015-01-21 00:11

Original link: http://blog.lmlphp.com/archives/65 from: lmlphp backyard

PHP 5.4 After the new gzip decompression function Gzdecode usage, gzdecode-decodes a gzip compressed string, unzip a string using gzip compression, which is written on the official website manual.

The current PHP version of a lot of space service providers have not reached 5.4, which also caused the function after using this function undefined error, how to solve the problem? PHP official web site users submitted a log in a good solution, using the Gzinflate function instead, the code reference is as follows:

<?phpif (!function_exists (' Gzdecode ')) {function Gzdecode ($data) {return gzinflate (substr ($data, 10,-8));}}

The functions of the Gzinflate function are roughly similar to those of Gzdecode, and in the comments of the return value, the official gives a hint "the function would return an error if the uncompressed data are more than 3 2768 times the length of the compressed input data or more than the optional parameter length. ”。

Read (84) reviews (0) View comments


PHP decompression function Gzdecode and gzinflate use method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.