Home >php教程 >PHP源码 >解决文件名解压后乱码的问题,使用将文件名进行转码

解决文件名解压后乱码的问题,使用将文件名进行转码

PHP中文网
PHP中文网Original
2016-05-25 17:12:161114browse

[PHP]代码   

<?php
$a=zip_open(&#39;other.zip&#39;);
while ($e=zip_read($a)){
    $fz = zip_entry_filesize($e);
    $fn = iconv(&#39;GBK&#39;,&#39;UTF-8&#39;,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 "$fz\t$fn\n";
    zip_entry_close($e);
}
zip_close($a);
?>

                   

                   

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
Previous article:PHP采集微博Next article:一个邮件发送类..