Extractto () method in PHP decompression ziparchive Linux+nginx file loss when extracting zip in the environment

Source: Internet
Author: User
Tags ziparchive

In the project to extract the zip file with ziparchive, the first test environment in the Windows platform, test through, to Linux+nginx environment when the problem (Zip package has files and directories of altogether more than 300 files, most of the file name with Chinese characters), The problem is: without the Chinese character of the file decompression is not a problem, there are some files with Chinese characters and digital letter decompression No problem, and then other plain text file name is lost, there is no error, and finally the problem to locate the Extractto () method, this method is a package method, Cannot see the actual source code.
However, found for ($i = 0; $i < $zip->numfiles; $i + +) Here can find all the files, the number is normal, then the problem will appear after the copy of the decompression link. So is it possible to use this cycle to extract their own copy of the file it??

So
for ($i = 0; $i < $zip->numfiles; $i + +) {
$filename = $zip->getnameindex ($i);

if (!is_dir ($filename)) {
Copy ("zip://". $path. " # ". $filename, $topath. $filename);
}else{
@mkdir ($topath. ' /'. $filename, 0777);
}
}

The problem has been overcome by ha. Looking for this problem wasted my day!! Hope to encounter the same files in the decompression when the lost classmates have help ha.

Extractto () method in PHP decompression ziparchive Linux+nginx file loss when extracting zip in the environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.