array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'context.zip.php', 1 => 'Zip 上下文选项', ), 'up' => array ( 0 => 'context.php', 1 => '上下文(Context)选项和参数', ), 'prev' => array ( 0 => 'context.params.php', 1 => 'Context 参数', ), 'next' => array ( 0 => 'context.zlib.php', 1 => 'Zlib 上下文选项', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'language/context/zip.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
Zip 上下文选项 — Zip 上下文选项列表
Zip 上下文选项可用于 zip
包装器。
版本 | 说明 |
---|---|
PHP 7.2.0, PECL zip 1.14.0 |
添加 password 。
|
示例 #1 基础 password
用法示例
<?php
// 读取加密归档
$opts = array(
'zip' => array(
'password' => 'secret',
),
);
// 创建上下文...
$context = stream_context_create($opts);
// ...并且使用它读取数据
echo file_get_contents('zip://test.zip#test.txt', false, $context);
?>