任何機構,請告訴我如何壓縮文件夾,並在laravel4下載該壓縮文件。Laravel 4如何壓縮文件
我需要壓縮,然後自動下載zipfolder.zip
後壓縮文件夾/public/zipfolder/
我這個包安裝
https://github.com/codeless/ziparchiveex
和路線
public function show($id)
{
//echo $id;
# ZipArchive as usual:
$zip = new ZipArchiveEx();
//$zip->open('my.zip', ZIPARCHIVE::OVERWRITE);
# Add whole directory including contents:
$zip->addDir('/public/zipfolder/');
# Only add the contents of the directory, but
# not the directory-entry of "mydir" itself:
//$zip->addDirContents('mydir');
# Close archive (as usual):
$zip->close();
}
我得到了下面
錯誤
ZipArchive::addEmptyDir()
:無效的或者未初始化Zip
對象
向我們展示你嘗試過什麼 –
@Imre L重新張貼 –