ZipArchive::extractTo without creating subdirector

2019-09-09 21:06发布

I have a zip file called myzip.zip. It contains /myzip/file1.png and /myzip/subdirectory/file2.png.

I wish to extract it to /home/me/somedirectory so I try:

$zip->extractTo('/home/me/somedirectory');

I now have:

/home/me/somedirectory/myzip/file1.png
/home/me/somedirectory/myzip/subdirectory/file2.png

But I wanted:

/home/me/somedirectory/file1.png
/home/me/somedirectory/subdirectory/file2.png

How can this be accomplished?

标签: php zip
0条回答
登录 后发表回答