php不解压读取压缩包内文件

来源:赵克立博客 分类: PHP 标签:php扩展发布时间:2020-02-09 23:56:54最后更新:2020-02-19 17:00:12浏览:895
版权声明:
本文为博主原创文章,转载请声明原文链接...谢谢。o_0。
更新时间:
2020-02-19 17:00:12
温馨提示:
学无止境,技术类文章有它的时效性,请留意文章更新时间,如发现内容有误请留言指出,防止别人"踩坑",我会及时更新文章
/**
 * 读取压缩包内文件
 * @authname [name]     0
 * @DateTime 2020-02-09
 * example readZipFile('E:/1.zip','composer.json')
 * @Author   mokuyu
 *
 * @param  string   $zipPath  压缩包全路径
 * @param  string   $filePath 压缩包内文件相对路径
 * @return [type]
 */
private function readZipFile($zipPath = '', $filePath = '')
{
    $content = false;
    $zip     = new ZipArchive;
    if ($zip->open($zipPath) === true) {
        $content = $zip->getFromName($filePath);
        $zip->close();
    }

    return $content;
}



微信号:kelicom QQ群:215861553 紧急求助须知
Win32/PHP/JS/Android/Python