1
我試圖在Kohana 3.3上使用ZipStream(https://github.com/Grandt/PHPZip)創建和流式傳輸zip文件。我認爲一旦將第一張圖像添加到壓縮文件中,壓縮文件就會流式傳輸,但是直到整個壓縮文件被創建併發送給用戶時,下載纔會停止。ZipStream和Kohana 3.3
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_Download extends Controller {
public function action_images()
{
require Kohana::find_file('vendor', 'ZipStream');
$zip = new ZipStream("images.zip");
foreach($images as $image)
{
$zip->addLargeFile($image);
}
$zip->finalize();
exit;
}
}