array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'de', ), 'this' => array ( 0 => 'ziparchive.getstreamindex.php', 1 => 'ZipArchive::getStreamIndex', 2 => 'Get a file handler to the entry defined by its index (read only)', ), 'up' => array ( 0 => 'class.ziparchive.php', 1 => 'ZipArchive', ), 'prev' => array ( 0 => 'ziparchive.getstream.php', 1 => 'ZipArchive::getStream', ), 'next' => array ( 0 => 'ziparchive.getstreamname.php', 1 => 'ZipArchive::getStreamName', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/zip/ziparchive/getstreamindex.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>
(PHP 8 >= 8.2.0, PECL zip >= 1.20.0)
ZipArchive::getStreamIndex — Get a file handler to the entry defined by its index (read only)
Get a file handler to the entry defined by its index. For now, it only supports read operations.
index
Index of the entry
flags
If flags is set to ZipArchive::FL_UNCHANGED
, the original unchanged
stream is returned.
Returns a file pointer (resource) on successBei einem Fehler wird false
zurückgegeben..
Beispiel #1 Get the entry contents with fread() and store it
<?php
$contents = '';
$z = new ZipArchive();
if ($z->open('test.zip')) {
$fp = $z->getStreamIndex(1, ZipArchive::FL_UNCHANGED);
if(!$fp) die($z->getStatusString());
echo stream_get_contents($fp);
fclose($fp);
}
?>