<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Zip context option listing</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="context.params.html">Context parameters</a></div> <div class="next" style="text-align: right; float: right;"><a href="wrappers.html">Supported Protocols and Wrappers</a></div> <div class="up"><a href="context.html">Context options and parameters</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="context.zip" class="refentry"> <div class="refnamediv"> <h1 class="refname">Zip context options</h1> <p class="refpurpose"><span class="refname">Zip context options</span> — <span class="dc-title">Zip context option listing</span></p> </div> <div class="refsect1 description" id="refsect1-context.zip-description"> <h3 class="title">Description</h3> <p class="para"> Zip context options are available for <em>zip</em> wrappers. </p> </div> <div class="refsect1 options" id="refsect1-context.zip-options"> <h3 class="title">Options</h3> <p class="para"> <dl> <dt id="context.zip.password"><code class="parameter">password</code></dt> <dd> <p class="para"> Used to specify password used for encrypted archive. </p> </dd> </dl> </p> </div> <div class="refsect1 changelog" id="refsect1-context.zip-changelog"> <h3 class="title">Changelog</h3> <p class="para"> <table class="doctable informaltable"> <thead> <tr> <th>Version</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>PHP 7.2.0, PECL zip 1.14.0</td> <td> Added <code class="parameter">password</code>. </td> </tr> </tbody> </table> </p> </div> <div class="refsect1 examples" id="refsect1-context.zip-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="iteratoraggregate.example.basic"> <p><strong>Example #1 Basic <code class="parameter">password</code> usage example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">// Read encrypted archive<br /></span><span style="color: #0000BB">$opts </span><span style="color: #007700">= array(<br /> </span><span style="color: #DD0000">'zip' </span><span style="color: #007700">=> array(<br /> </span><span style="color: #DD0000">'password' </span><span style="color: #007700">=> </span><span style="color: #DD0000">'secret'</span><span style="color: #007700">,<br /> ),<br />);<br /></span><span style="color: #FF8000">// create the context...<br /></span><span style="color: #0000BB">$context </span><span style="color: #007700">= </span><span style="color: #0000BB">stream_context_create</span><span style="color: #007700">(</span><span style="color: #0000BB">$opts</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// ...and use it to fetch the data<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">file_get_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">'zip://test.zip#test.txt'</span><span style="color: #007700">, </span><span style="color: #0000BB">false</span><span style="color: #007700">, </span><span style="color: #0000BB">$context</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="context.params.html">Context parameters</a></div> <div class="next" style="text-align: right; float: right;"><a href="wrappers.html">Supported Protocols and Wrappers</a></div> <div class="up"><a href="context.html">Context options and parameters</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>