note 37482 added to ref.zlib
| From: | thivierr at telus dot net | Date: | Mon, 17 Nov 2003 09:02:14 +0000 |
| Subject: | note 37482 added to ref.zlib | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-60478@lists.php.net to get a copy of this message | ||
I found the absolute easiest way to read a gzip file is as follows:
echo file_get_contents("compress.zlib:///myphp/test.txt.gz");
To create a gzip file:
file_put_contents("compress.zlib:///myphp/test.txt.gz","Put this in the
file\r\n");
Things to note about this:
-The best prefix to use is "compress.zlib", not "zlib"
-If you wish to specify a path starting in the root path, you actually end up with three slashes.
The above path corresponds to "/myphp/test.txt" on unix, and "c:\myphp\test.txt"
on Windows (if C: is the current drive). I tested it just on Windows.
-Compression and decompression both use the same prefix of "compress.zlib://" (plus one
more slash to get a root dir).
-I'm using 5.0, so I'm not 100% sure which behaviour started in which version.
----
Manual Page -- http://www.php.net/manual/en/ref.zlib.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37482
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37482&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37482&report=yes
Search -- http://master.php.net/manage/user-notes.php