您好,欢迎访问一九零五行业门户网

PHP Zip上下文选项

introductionphp's zip extension registers zip:// wrapper. php 7.2.0 onwards supports passwords for encrypted archives. there is only one zip context option called password
examplefirst create zip archive as follows:
<?php$zip = new ziparchive;$zip->open('test.zip');$zip->setpassword("mysecretpassword");$zip->addfile('c:/xampp/php/test.txt', 'test.txt');$zip->close();>>
要从zip://流中读取文件,请使用以下代码
<?php$opts = array( 'zip' => array( 'password' => 'secret', ),);$context = stream_context_create($opts);echo file_get_contents('zip://test.zip#test.txt', false, $context);?>
以上就是php zip上下文选项的详细内容。
其它类似信息

推荐信息