The Extractto () method in PHP's decompression ziparchive the problem of file loss when extracting zip in Linux+nginx environment

Source: Internet
Author: User
Tags copy zip ziparchive linux
In the project to use ziparchive unzip the zip file, the initial test environment in the Windows platform, test pass, into the LINUX+NGINX environment when the problem (in the ZIP package is a total of more than 300 files and folders, mostly with Chinese characters file name), The phenomenon of the problem is: without the Chinese characters of the file decompression is no problem, and there are some Chinese characters and digital letters of the file decompression no problem, and then other pure text file name is lost, there is no error, and finally the problem to locate the Extractto () method, this method is a encapsulation method,       The actual source code is not visible. However, discovery for ($i = 0; $i < $zip->numfiles; $i + +) Here you can find all the files, the number is normal, then the problem appears after the copy link.      So is it possible to use this loop to extract their own copy files??     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 is solved ha. Finding this problem has wasted my day!! Hope to encounter the same file in the decompression when the lost students help ha.

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.