ZipArchive::getStreamIndex
(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 success 或者在失败时返回 false
.
示例
示例 #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);
}
?>
+添加备注
用户贡献的备注
此页面尚无用户贡献的备注。
备份地址:http://www.lvesu.com/blog/php/ziparchive.getstreamindex.php