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