drupal配合使用pclzip 解压,压缩文件

使用pclzip只需使用http://www.phpconcept.net/pclzip官网的文件,看一下开发文档:
这里有pclzip使用介绍http://www.ccvita.com/59.html
以下是特别注意的一些信息

//解壓縮到extract/folder/這個目錄中
$list = $archive->extract(PCLZIP_OPT_PATH, "extract/folder/");
 
//把所有路徑都去掉,這個壓縮檔建立完後,裡面就只會有file.txt跟image.gif,不會有目錄了
$list = $archive->create("data/file.txt images/image.gif",PCLZIP_OPT_REMOVE_ALL_PATH);
 

接着就是配合drupal使用pclzip了:给出一段示例

$pclzip_path = libraries_get_path('pclzip');
            $pclzip_themefile = libraries_get_path('themefile');
              
             require_once($pclzip_path.'/pclzip.lib.php');
            $archive = new PclZip($pclzip_themefile."/themefile/".$filenamehou);
             if ($archive->extract(PCLZIP_OPT_PATH, $pclzip_path.'/html/'.$filenamehou,               
              PCLZIP_OPT_REMOVE_PATH, 'install/release') == 0) { 
                 //當有錯誤的時候,可以用這個顯示錯誤訊息 
                 die("Error : ".$archive->errorInfo(true)); 
            }

你可能感兴趣的:(drupal)