简体   繁体   English

为什么 php ziparchive 的 extractTo 方法创建一个深度级别,而不是文件夹树? (文件夹名称是西里尔字母)

[英]why php ziparchive's extractTo method creates one-depth-level, instead folders tree? (folders names are cyrillic)

I Working with web server that works on unix.我使用在 unix 上工作的 web 服务器。

I have zip archive which contains some folders tree:我有 zip 存档,其中包含一些文件夹树:

section1
**subsection1-1
**subsection2-2

section2
**subsection2-1

All section's names are on cyrillic .所有部分的名称都是cyrillic字母。

When i try to extract this archive by using $zip->extractTo(...) , i get only one depth level of sections.当我尝试使用$zip->extractTo(...)提取此存档时,我只得到一个深度级别的部分。

section1
subsection1-1
subsection1-2
section2
subsection2-1

(same situation with nested files. they appears at the root level instead parent level) (嵌套文件的情况相同。它们出现在根级别而不是父级别)

I Fixed.我解决了。 The reason was: that my zip archive with folders was created by php's ziparchive on windows server.原因是:我的带有文件夹的 zip 存档是由 windows 服务器上的 php ziparchive 创建的。 And when it was created - the local names of files and folders was with "\" separator.当它被创建时 - 文件和文件夹的本地名称带有“\”分隔符。 And i tried to export it on unix's server;我试图将它导出到 unix 的服务器上;

I fixed code of creating zip, by replacing "\" to "/" and it works fine now.我通过将“\”替换为“/”修复了创建 zip 的代码,现在它工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM