PHP code example of w7 / rangine-zipstream
1. Go to this page and download the library: Download w7/rangine-zipstream library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
w7 / rangine-zipstream example snippets
$options = new \ZipStream\Option\Archive();
$options->setSendHttpHeaders(true);
//指定 output 对象为 swoole response对象
$options->setOutputStream($this->response());
$zip = new \W7\ZipStream\ZipStream('example.zip', $options);
for ($i=0; $i<100000; $i++) {
$zip->addFile($i, 'test');
}
$zip->finish();