Home>Article>Backend Development> How to decompress compressed package in php

How to decompress compressed package in php

王林
王林 Original
2019-09-21 17:58:35 5601browse

How to decompress compressed package in php

php implements decompression of ZIP compressed files

First: You need to enable the configuration of php_aip.dll

 ".$i++." 此文件已被跳过,原因:文件过大, -> ".iconv("gb2312","utf-8",$file_name)." 

"; } } //关闭当前 zip_entry_close($dir_resource); } } //关闭压缩包 zip_close($resource); $endtime = explode(' ',microtime()); //解压结束的时间 $thistime = $endtime[0]+$endtime[1]-($starttime[0]+$starttime[1]); $thistime = round($thistime,3); //保留3为小数 echo "

解压完毕!,本次解压花费:$thistime 秒。

"; } $size = get_zip_originalsize('../../textaa.zip','../../ffff/');

In the above method: $filename: file name, is the name of the file to be decompressed, including the path relative to the method, $path represents: decompress to (what directory, ending with / ).

The second method is: use the class that comes with pclzip. The first method was adopted during the project due to path problems

open('test.zip') === TRUE) {//中文文件名要使用ANSI编码的文件格式 $zip->extractTo('foldername');//提取全部文件 //$zip->extractTo('/my/destination/dir/', array('pear_item.gif', 'testfromfile.php'));//提取部分文件 $zip->close(); echo 'ok'; } else { echo 'failed'; }

Recommended tutorial:PHP video tutorial

The above is the detailed content of How to decompress compressed package in php. For more information, please follow other related articles on the PHP Chinese website!

php
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:How php solves big data Next article:How php solves big data