Home >Backend Development >PHP Tutorial >How to display file extensions, solve the problem of garbled file names after decompression, and code to transcode file names.

How to display file extensions, solve the problem of garbled file names after decompression, and code to transcode file names.

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-29 08:47:371597browse

Copy code The code is as follows:


$a=zip_open('other.zip');
while ($e=zip_read($a)){
$fz = zip_entry_filesize($ e);
$fn = iconv('GBK','UTF-8',zip_entry_name($e));
if (!$fz){//dir
mkdir($fn);
continue;
}
if (!zip_entry_open($a, $e))
continue;
file_put_contents($fn, zip_entry_read($e, $fz));
echo "$fzt$fnn";
zip_entry_close($e);
}
zip_close($a);
?>

The above introduces how to display the file suffix name and solve the problem of garbled file names after decompression. The code for transcoding the file name includes how to display the file suffix name. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn