简体   繁体   English

DS_Store文件在ZipArchive :: extractTo中创建

[英]DS_Store file is created on ZipArchive::extractTo

I'm creating a PHP script, which supposed to extract a zip archive stored on the php file directory to a folder. 我正在创建一个PHP脚本,该脚本应该将存储在php文件目录中的zip存档提取到一个文件夹中。
Everything works well, but when I check te result, I find 2 folders under the directory: a folder with the name of the zip archive, and another folder named __MACOSX . 一切正常,但是当我检查结果时,我在目录下找到2个文件夹:一个名为zip存档的文件夹,另一个名为__MACOSX文件夹。 I don't know how this folder came there, especially as I'm using Windows 7. Second, in each folder there is a file called .DS_Store . 我不知道该文件夹是怎么出现的,尤其是当我使用Windows 7时。其次,每个文件夹中都有一个名为.DS_Store的文件。
Now, I don't know how these things got there. 现在,我不知道这些东西是怎么到达那里的。 This is my code: 这是我的代码:

$zip = new ZipArchive;
if ($zip->open('File.zip')) {
    $path = getcwd() . "/details/" . trim($id) . "/";
    $path = str_replace("\\","/",$path);
    echo $path;
    echo $zip->extractTo($path);
    $zip->close();
    echo 'ok';
} else {
    echo 'failed';
}

This is the only code that extracts the zip file, or touching it, and as you can see, there is nothing like __MACOSX or .DS_Store . 这是提取或触摸zip文件的唯一代码,如您所见,没有类似__MACOSX.DS_Store

Can you please help me? 你能帮我么?

File.zip originated on a OSX system. File.zip起源于OSX系统。 __MACOSX and .DS_Store have 0 usage or bearing on any other OS. __MACOSX.DS_Store用法为0或与任何其他OS有关。 Delete / Ignore them and keep trucking. 删除/忽略它们并继续运输。

As an aside, you may want to add the stated file system objects to your project .gitignore. 顺便说一句,您可能希望将陈述的文件系统对象添加到项目.gitignore中。

https://superuser.com/questions/104500/what-is-macosx-folder https://en.wikipedia.org/wiki/.DS_Store https://superuser.com/questions/104500/what-is-macosx-folder https://en.wikipedia.org/wiki/.DS_Store

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

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