當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zip::extractZip方法代碼示例

本文整理匯總了PHP中Zip::extractZip方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zip::extractZip方法的具體用法?PHP Zip::extractZip怎麽用?PHP Zip::extractZip使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zip的用法示例。


在下文中一共展示了Zip::extractZip方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: install

 public function install($filename)
 {
     $src = ROOT . '/sys/tmp/' . $filename;
     $dest = ROOT . '/sys/tmp/install_plugin/';
     Zip::extractZip($src, $dest);
     if (!file_exists($dest)) {
         $this->errors = __('Some error occurred');
         return false;
     }
     $tmp_plugin_path = glob($dest . '*', GLOB_ONLYDIR);
     $tmp_plugin_path = $tmp_plugin_path[0];
     $plugin_basename = substr(strrchr($tmp_plugin_path, '/'), 1);
     $plugin_path = ROOT . '/sys/plugins/' . $plugin_basename;
     copyr($dest, ROOT . '/sys/plugins/', 0755);
     $this->files = getDirFiles($plugin_path);
     if (file_exists($plugin_path . '/config.dat')) {
         $config = json_decode(file_get_contents($plugin_path . '/config.dat'), true);
         include_once $plugin_path . '/index.php';
         $className = $config['className'];
         $obj = new $className(null);
         if (method_exists($obj, 'install')) {
             $obj->install();
         }
     }
     _unlink($src);
     _unlink($dest);
     return true;
 }
開發者ID:VictorSproot,項目名稱:AtomXCMS-2,代碼行數:28,代碼來源:plugins.class.php

示例2: foreach

 if ($deleteList) {
     foreach ($deleteList as &$curFile) {
         $curFile = trim($curFile);
         if ($curFile && substr($curFile, 0, 1) != "/") {
             $fileName[] = $curFile;
         }
     }
 }
 $writingZip = new Zip(KB_CACHEDIR . '/update/backup/' . $codeversion . '.zip');
 $writingZip->addFileArray($fileName);
 if ($writingZip->createZip()) {
     if ($writingZip->getErrors()) {
         $page_error[] = $writingZip->getErrors();
     }
 }
 $readingZip->extractZip(getcwd());
 if ($deleteList) {
     foreach ($deleteList as $curFile) {
         if ($curFile && substr($curFile, 0, 1) != "/") {
             if (file_exists($curFile) && !@unlink($curFile)) {
                 $page_error[] = "Could not unlink " . $curFile;
             }
         }
     }
 }
 if ($readingZip->getErrors()) {
     $page_error[] = $readingZip->getErrors();
 } else {
     Config::set('upd_CodeVersion', $piece['version']);
     $qry = DBFactory::getDBQuery(true);
     $qry->execute("INSERT INTO `kb3_config` (cfg_site, cfg_key, cfg_value) " . "SELECT cfg_site, 'upd_codeVersion', '{$piece['version']}' FROM `kb3_config` " . "GROUP BY cfg_site ON DUPLICATE KEY UPDATE cfg_value = '{$piece['version']}';");
開發者ID:biow0lf,項目名稱:evedev-kb,代碼行數:31,代碼來源:admin_upgrade.php


注:本文中的Zip::extractZip方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。