PHP Compression and archive--zlib

Source: Internet
Author: User
Tags string to file uncompress
Most file system functions use Gzip to compress files, and this module can help transparently read gzip compressed files.

Zlib Support in PHP is not enabled by default. Use--with-zlib[=dir when you need to install the PHP configuration).

The following example opens a temporary file to write the test string, and then prints the contents of the file two times.

Example #1 A simple zlib example

<?php    $filename = Tempnam ('/tmp ', ' zlibtest '). '. Gz ';    echo "

Related functions:

Gzclose-close an open gz-file pointer

Gzcompress-compress a string

Gzdecode-decodes a gzip compressed string

Gzdeflate-deflate a string

Gzencode-create a gzip compressed string

Gzeof-test for EOF on a gz-file pointer

Gzfile-read entire gz-file to an array

Gzgetc-get character from Gz-file pointer

Gzgets-get line from File pointer

Gzgetss-get line from Gz-file pointer and strip HTML tags

Gzinflate-inflate a deflated string

Gzopen-open Gz-file

Gzpassthru-output all remaining data on a gz-file pointer

gzputs-alias Gzwrite

Gzread-binary-safe Gz-file Read

Gzrewind-rewind the position of a gz-file pointer

Gzseek-seek on a gz-file pointer

Gztell-tell gz-file pointer read/write position

Gzuncompress-uncompress a compressed string

Gzwrite-binary-safe Gz-file Write

Readgzfile-output a Gz-file

Zlib_decode-uncompress any RAW/GZIP/ZLIB encoded data

Zlib_encode-compress data with the specified encoding

Zlib_get_coding_type-returns the coding type used for output compression

  • Related Article

    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.