cvs: /phpdoc global.ent /phpdoc/functions zlib.sgml

From: Date: Mon, 06 Sep 1999 09:00:15 +0000
Subject: cvs: /phpdoc global.ent /phpdoc/functions zlib.sgml
Groups: php.dev 
Request: Send a blank email to php-dev+get-10605@lists.php.net to get a copy of this message
sr Mon Sep 6 05:00:15 1999 EDT Modified files: /phpdoc global.ent /phpdoc/functions zlib.sgml Log: Added small zlib example. Index: phpdoc/global.ent diff -u phpdoc/global.ent:1.3 phpdoc/global.ent:1.4 --- phpdoc/global.ent:1.3 Sun Jun 20 08:05:09 1999 +++ phpdoc/global.ent Mon Sep 6 05:00:14 1999 @@ -1,6 +1,6 @@ <!-- -*- SGML -*- - $Id: global.ent,v 1.3 1999/06/20 12:05:09 sas Exp $ + $Id: global.ent,v 1.4 1999/09/06 09:00:14 sr Exp $ Contains global "macros" for all the SGML documents. @@ -44,6 +44,7 @@ <!ENTITY url.vmailmgr "http://www.qcc.sk.ca/~bguenter/distrib/vmailmgr/"> <!ENTITY url.win32install "http://www.umesd.k12.or.us/php/win32install.html"> <!ENTITY url.wddx "http://www.wddx.org"> +<!ENTITY url.zlib "http://www.cdrom.com/pub/infozip/zlib/"> <!ENTITY book.applied.cryptography 'Applied Cryptography by Schneier (ISBN 0-471-11709-9)'> Index: phpdoc/functions/zlib.sgml diff -u phpdoc/functions/zlib.sgml:1.3 phpdoc/functions/zlib.sgml:1.4 --- phpdoc/functions/zlib.sgml:1.3 Sun Sep 5 23:22:00 1999 +++ phpdoc/functions/zlib.sgml Mon Sep 6 05:00:14 1999 @@ -1,13 +1,57 @@ - <reference id="ref.zlib"> <title>Compression functions</title> <titleabbrev>Zlib</titleabbrev> <partintro> + <para> + This module uses the functions of <ulink + url="&url.zlib;">zlib</ulink> by Jean-loup Gailly and Mark Adler to + transparently read and write gzip (.gz) compressed files. You have + to use a zlib version >= 1.0.9 with this module. + </para> <para> - This module uses the functions of zlib (<ulink - url="http://www.cdrom.com/pub/infozip/zlib/">http://www.cdrom.com/pub/infozip/zlib/</ulink>) - by Jean-loup Gailly and Mark Adler to transparently read and write gzip - (.gz) compressed files. + This module contains versions of most of the <link + linkend="ref.filesystem">filesystem</link> functions which work + with gzip-compressed files (and uncompressed files, too, but not + with sockets). + </para> + + <sect1 id="zlib-example"> + <title>Small code example</title> + <para> + Opens a temporary file and writes a test string to it, then it + prints out the content of this file twice. + </para> + + <example> + <title>Small Zlib example</title> +<programlisting role=php> +&lt;?php + $filename = tempnam('/tmp', 'zlibtest').'.gz'; + print "&lt;html>\n&lt;head>&lt;/head>\n&lt;body>\n&lt;pre>\n"; + $s = "Only a test, test, test, test, test, test, test, test!\n"; + // open file for writing with maximum compression + $zp = gzopen($filename, "w9"); + // write string to file + gzwrite($zp, $s); + // close file + gzclose($zp); + // open file for reading + $zp = gzopen($filename, "r"); + // read 3 char + print gzread($zp, 3); + // output the the of the file and close it. + gzpassthru($zp); + print "\n"; + // open file and print content (the 2nd time). + if (readgzfile($filename) != strlen($s)) { + echo "Error with zlib functions!"; + } + unlink($filename); + print "&lt;pre>\n&lt;/h1>&lt;/body>\n&lt;/html>\n"; +?> +</programlisting> + </example> + </partintro> <refentry id="function.gzclose">

« previous php.dev (#10605) next »