該文檔說明了如何集成Dropbox flysystem適配器,但沒有告訴您如何與ZipArchive適配器或類似集成。Laravel Flysystem與Zip Archive適配器集成
https://laravel.com/docs/5.4/filesystem#custom-filesystems
https://github.com/thephpleague/flysystem-ziparchive
我試圖讀數超過上FilesystemManager.php方法是含有在該文檔示例中使用的擴展方法的類。我發現了一種稱爲「適應」的方法,看起來可能是票證。
我試圖從存儲門面調用此方法像這樣:
return $storage_with_zip = Storage::adapt(new \League\Flysystem\ZipArchive\ZipArchiveAdapter($file->getRealPath()));
,但我得到這個錯誤:
BadMethodCallException Call to undefined method League\Flysystem\Filesystem::adapt
任何人都有成功整合Laravel文件系統與ZipArchiveAdapter?我知道我可以使用PHP本地ZipArchive,但是我想讓文件系統中的所有內容都使用Laravel包裝器。
謝謝!
***更新
我的最終目標是要能夠上傳拉鍊解壓到存儲/目錄或S3。
例1) $file = Storage::disk('local')->extractTo('unzipped/', $file);
,而不是這樣的:
$zip = new ZipArchive();
$zip->open($file->getRealPath());
$zip->extractTo(storage_path('app') . 'unzipped');
例2) $file = Storage::disk('s3')->extractTo('unzipped/', $file);
需要幾藉此在,感謝您的答覆 –