从PHP中的ZIP提取特定文件 [英] Extracting specific files from ZIP in PHP

查看:113
本文介绍了从PHP中的ZIP提取特定文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个ZIP文件,其结构是:

If I have a ZIP file whose structure is:

  -directory1 DIR
      -files in here
  -directory2 DIR
      -more files in here

如何使用pclzip.lib.php打开此ZIP文件并将directory1(递归)提取到一个目录中,然后将directory2(递归)提取到另一个目录中.

Using pclzip.lib.php how can I open up this ZIP file and extract directory1 (recursive) into a directory and then extract directory2 (recursive) into another directory.

推荐答案

您应该能够使用PCLZIP_OPT_BY_NAME选项来选择要提取的存档中的哪个路径. PCLZIP_OPT_PATH应该确定该分支将被写入的位置.

You should be able to use the PCLZIP_OPT_BY_NAME option to select which path inside the archive you want to extract. PCLZIP_OPT_PATH ought to determine where that branch will be written.

但这只是浏览手册之后的猜测-我从未使用过这个特定的库.

But that's just a guess after browsing the manual -- I've never used this particular library.

这篇关于从PHP中的ZIP提取特定文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆