mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 17:08:54 +00:00
Added documentation for gzdeflate/gzinflate/gzencode, fixed incorrect
algorithm reference in gzcompress. Added urls for ZLIB, DEFLATE and GZIP. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@42853 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
093918c1d2
commit
d506dda6a8
1 changed files with 141 additions and 4 deletions
|
@ -609,7 +609,7 @@ gzclose ($zd);
|
|||
<refentry id="function.gzcompress">
|
||||
<refnamediv>
|
||||
<refname>gzcompress</refname>
|
||||
<refpurpose>Deflate a string</refpurpose>
|
||||
<refpurpose>Compress a string</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
@ -624,11 +624,16 @@ gzclose ($zd);
|
|||
</funcsynopsis>
|
||||
<para>
|
||||
This function returns a compressed version of the input
|
||||
<parameter>data</parameter> using the deflate algorithm,
|
||||
<parameter>data</parameter> using the ZLIB algorithm,
|
||||
or false if an error is encountered. The optional parameter
|
||||
<parameter>level</parameter> can be given as 0 for no
|
||||
compression up to 9 for maximum compression.
|
||||
</para>
|
||||
<para>
|
||||
For details on the ZLIB compression algorithm see the document
|
||||
"<ulink url="&url.rfc1950;">ZLIB Compressed Data Format
|
||||
Specification version 3.3</ulink>" (RFC 1950).
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
This is <emphasis>not</emphasis> the same as gzip compression,
|
||||
|
@ -637,7 +642,10 @@ gzclose ($zd);
|
|||
</para>
|
||||
</note>
|
||||
<para>
|
||||
See also <function>gzuncompress</function>.
|
||||
See also <function>gzdeflate</function>,
|
||||
<function>gzinflate</function>,
|
||||
<function>gzuncompress</function>,
|
||||
<function>gzencode</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@ -658,7 +666,7 @@ gzclose ($zd);
|
|||
</paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
<para>
|
||||
This function takes <parameter>data</parameter> compressed by
|
||||
<function>gzcompress</function> and returns the original
|
||||
uncompressed data or false on error. The function will return an
|
||||
|
@ -666,8 +674,137 @@ gzclose ($zd);
|
|||
of the compressed input <parameter>data</parameter> or more than
|
||||
the optional parameter <parameter>length</parameter>.
|
||||
</para>
|
||||
<para>
|
||||
See also <function>gzdeflate</function>,
|
||||
<function>gzinflate</function>,
|
||||
<function>gzcompress</function>,
|
||||
<function>gzencode</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<refentry id="function.gzdeflate">
|
||||
<refnamediv>
|
||||
<refname>gzdeflate</refname>
|
||||
<refpurpose>Deflate a string</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<funcsynopsis>
|
||||
<funcprototype>
|
||||
<funcdef>string <function>gzdeflate</function></funcdef>
|
||||
<paramdef>string <parameter>data</parameter></paramdef>
|
||||
<paramdef>int
|
||||
<parameter><optional>level</optional></parameter>
|
||||
</paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
This function returns a compressed version of the input
|
||||
<parameter>data</parameter> using the DEFLATE algorithm,
|
||||
or false if an error is encountered. The optional parameter
|
||||
<parameter>level</parameter> can be given as 0 for no
|
||||
compression up to 9 for maximum compression.
|
||||
</para>
|
||||
<para>
|
||||
For details on the DEFLATE compression algorithm see the document
|
||||
"<ulink url="&url.rfc1951;">DEFLATE Compressed Data Format
|
||||
Specification version 1.3</ulink>" (RFC 1951).
|
||||
</para>
|
||||
<para>
|
||||
See also
|
||||
<function>gzinflate</function>,
|
||||
<function>gzcompress</function>,
|
||||
<function>gzuncompress</function>,
|
||||
<function>gzencode</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<refentry id="function.gzinflate">
|
||||
<refnamediv>
|
||||
<refname>gzinflate</refname>
|
||||
<refpurpose>Inflate a deflated string</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<funcsynopsis>
|
||||
<funcprototype>
|
||||
<funcdef>string <function>gzinflate</function></funcdef>
|
||||
<paramdef>string <parameter>data</parameter></paramdef>
|
||||
<paramdef>int
|
||||
<parameter><optional>length</optional></parameter>
|
||||
</paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
This function takes <parameter>data</parameter> compressed by
|
||||
<function>gzdeflate</function> and returns the original
|
||||
uncompressed data or false on error. The function will return an
|
||||
error if the uncompressed data is more than 256 times the length
|
||||
of the compressed input <parameter>data</parameter> or more than
|
||||
the optional parameter <parameter>length</parameter>.
|
||||
</para>
|
||||
<para>
|
||||
See also <function>gzcompress</function>.
|
||||
<function>gzuncompress</function>,
|
||||
<function>gzdeflate</function>,
|
||||
<function>gzencode</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<refentry id="function.gzencode">
|
||||
<refnamediv>
|
||||
<refname>gzencode</refname>
|
||||
<refpurpose>Create a gzip compressed string</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<funcsynopsis>
|
||||
<funcprototype>
|
||||
<funcdef>string <function>gzencode</function></funcdef>
|
||||
<paramdef>string <parameter>data</parameter></paramdef>
|
||||
<paramdef>int
|
||||
<parameter><optional>level</optional></parameter>
|
||||
</paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
This function returns a compressed version of the input
|
||||
<parameter>data</parameter> compatible with the output of
|
||||
the <command>gzip</command> program,
|
||||
or false if an error is encountered. The optional parameter
|
||||
<parameter>level</parameter> can be given as 0 for no
|
||||
compression up to 9 for maximum compression, if not given
|
||||
the default compression level will be 1.
|
||||
</para>
|
||||
<para>
|
||||
The resulting data contains the appropriate headers and data
|
||||
structure to make a standard .gz file, e.g.:
|
||||
<example>
|
||||
<title>Creating a gzip file</title>
|
||||
<programlisting role="php">
|
||||
<?php
|
||||
$data = implode("", "bigfile.txt");
|
||||
$gzdata = gzencode($data, 9);
|
||||
$fp = fopen("bigfile.txt.gz", "w");
|
||||
fwrite($fp, $gzdata);
|
||||
fclose($fp);
|
||||
?>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
For more information on the GZIP file format, see the document:
|
||||
<ulink url="&url.rfc1952">GZIP file format specification
|
||||
version 4.3</ulink>.
|
||||
</para>
|
||||
<para>
|
||||
See also <function>gzcompress</function>.
|
||||
<function>gzuncompress</function>,
|
||||
<function>gzdeflate</function>,
|
||||
<function>gzinflate</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
|
Loading…
Reference in a new issue