Unzip iside specific directory server

问题内容:

I use a lib to extract element downloaded in specific directory before to unzip

I use PclZip in this moment but I think it’s obsolete.
I would know if I use the zip php I can extract with restriction on specific directory like element below

 $zip_file = $this->getGithubClicShoppingMasterArchive();
 $archive = new \PclZip($zip_file);

 $list = $archive->listContent(); // verify if the is a content 

 if ($list == 0) {
   die("Error : " . $archive->errorInfo(true));
 }

  $extract = $archive->extract(PCLZIP_OPT_EXTRACT_DIR_RESTRICTION, $this->OnlineUpdates .'/',
                               PCLZIP_OPT_PATH, $this->OnlineUpdates
                              );

// directory restriction

Thank you

问题评论:

1  
PHP’s ZipArchive is pretty covered in the manual.
    
I second migrating the logic to ZipArchive, much easier to use and is well maintained.

原文地址:

https://stackoverflow.com/questions/47756278/unzip-iside-specific-directory-server

Tags:,

Add a Comment