gzcompress Compress a string php函数


gzcompress

(PHP 4 >= 4.0.1, PHP 5)

gzcompressCompress a string

说明

string gzcompress ( string $data [, int $level = -1 ] )

This function compress the given string using the ZLIB data format.

For details on the ZLIB compression algorithm see the document "» ZLIB Compressed Data Format Specification version 3.3" (RFC 1950).

Note:

This is not the same as gzip compression, which includes some header data. See gzencode() for gzip compression.

参数

data

The data to compress.

level

The level of compression. Can be given as 0 for no compression up to 9 for maximum compression.

返回值

The compressed string or FALSE if an error occurred.

范例

Example #1 gzcompress() example

<?php
$compressed 
gzcompress('Compress me'9);
echo 
$compressed;
?>

参见



相关阅读:
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 into 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 别名 gzwrite
gzread Binary-safe gz-file read
gzrewind Rewind the position of a gz-file pointer
快速导航

Copyright © 2016 phpStudy |