0
我正在使用該方法生成示例zip文件。Laravel 5.4中的Zipstream - 數據已損壞
不幸的是,zip文件的輸出沒有解壓縮到預期的輸入。
public function generateZip(Request $req) {
$response = new StreamedResponse(function()
{
$opt = array(
'comment' => 'test zip file.',
'send_headers'=>true,
);
$zip = new ZipStream\ZipStream('example.zip');
# create a file named 'hello.txt'
$zip->addFile('hello.txt', 'This is the contents of hello.txt');
# finish the zip stream
$zip->finish();
});
return $response;
文件生成example.zip
,並在解壓縮文件解壓縮「hello.txt的」,但它的內容是一個新的空白行,然後
…»,V¢íåTÖ‰¸ºí‘ºíbÖ¸4Öå‘úú|Ωíä
我的努力已經關閉基於這個代碼:
我的調試步驟啓動此:
1)試圖產生壓縮此使用Amazon S3流
2)與設置修改一下,除去壓縮
3)分離的問題,以最簡單的結果
4)添加輸出緩衝&輸出平齊試圖攔截任何輸出。
我的路線是這樣的:
Route::get("/generate-zip", '[email protected]');