note 103425 modified in wrappers.compression by danbrown
| From: | danbrown@php.net | Date: | Tue, 12 Apr 2011 14:43:55 +0000 |
| Subject: | note 103425 modified in wrappers.compression by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-178776@lists.php.net to get a copy of this message | ||
Example on how to read an entry from a ZIP archive (file "bar.txt" inside
"./foo.zip"):
<?php
$fp = fopen('zip://./foo.zip#bar.txt', 'r');
if( $fp ){
while( !feof($fp) ){
echo fread($fp, 8192);
}
fclose($fp);
}
?>
Also, apparently, the "zip:" wrapper does not allow writing as of PHP/5.3.6. You can read
http://php.net/ziparchive-getstream for further
reference since the underlying code is probably the same.
--was--
Example on how to read an entry from a ZIP archive (file "bar.txt" inside
"./foo.zip"):
<?php
$fp = fopen('zip://./foo.zip#bar.txt', 'r');
if( $fp ){
while( !feof($fp) ){
echo fread($fp, 8192);
}
fclose($fp);
}
?>
http://php.net/manual/en/wrappers.compression.php