stolentine / zip-partial-reader
curl读取zip存档中一个文件的客户端
v0.1.1
2022-12-08 12:54 UTC
Requires
- php: ^8.1
- ext-curl: *
- ext-zlib: *
This package is auto-updated.
Last update: 2024-09-08 17:10:14 UTC
README
curl读取zip存档中一个文件的客户端。
use Stolentine\ZipPartialReader\ZipPartialReader; $zip = ZipPartialReader::openUrl('https://example.com/foo.zip'); $path = '/var/www/files/'; $pathName = '/var/www/files/fooBazBar.xml'; $filePathName = 'baz/bar.xml'; foreach ($zip->getFiles() as $file) { if (str_starts_with($file->name, $filePathName)) { $zip->extractToDir($file, new SplFileInfo($path)); // or $zip->extractToFile($file, new SplFileInfo($pathName)); } }