ZipArchive::extractTo without creating subdirector

2019-09-09 21:43发布

问题:

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