Heim  >  Artikel  >  Backend-Entwicklung  >  PclZip让php轻松实现压缩与解压_PHP教程

PclZip让php轻松实现压缩与解压_PHP教程

WBOY
WBOYOriginal
2016-07-21 14:52:091029Durchsuche

PclZip介绍
PclZip library能够压缩与解压缩Zip格式的压缩档(WinZip、PKZIP);且能对此类类档案进行处理,包括产生压缩档、列出压缩档的内容以及解压缩档案等等。由于能够在伺服器端进行压缩与解压缩的动作,所以相当方便使用。
PclZip定义一个PclZip类别,其类别物件可视为一个ZIP档案,亦提供method来进行处理。
 
 
PclZip官方地址:http://www.phpconcept.net/pclzip/index.php

实例代码
 
include_once('pclzip.lib.php');  //加载类文件
$filename=time().'bnxf.zip';//压缩后的文件名
$path='../../..'.$_GET['path'];//需要压缩的文件
$archive = new PclZip($filename);
$v_list = $archive->create($path,PCLZIP_OPT_REMOVE_ALL_PATH,PCLZIP_OPT_ADD_PATH,'bnxf'); //将压缩的文件目录改为bnxf
if ($v_list == 0) {
die("Error : ".$archive->errorInfo(true));
}else{
echo"压缩成功";


}
?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/371684.htmlTechArticlePclZip介绍 PclZiplibrary能够压缩与解压缩Zip格式的压缩档(WinZip、PKZIP);且能对此类类档案进行处理,包括产生压缩档、列出压缩档的内容以...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn