当前位置: 首页>>代码示例>>PHP>>正文


PHP Zip::create方法代码示例

本文整理汇总了PHP中Zip::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Zip::create方法的具体用法?PHP Zip::create怎么用?PHP Zip::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zip的用法示例。


在下文中一共展示了Zip::create方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createZip

 public function createZip()
 {
     $name = q('get.name');
     Zip::PclZip("app.zip");
     //设置压缩文件名
     Zip::create("addons/{$name}");
     //压缩目录
     \Tool::download("app.zip", $name . '.zip');
 }
开发者ID:houdunwang,项目名称:hdcms,代码行数:9,代码来源:Module.php

示例2: addslashes

        $dumpfile = $backupfile . '.sql';
        @unlink($dumpfile);
        $mysqlbin = $mysql_base == '/' ? '' : addslashes($mysql_base) . 'bin/';
        $_SC['dbcharset'] = empty($_SC['dbcharset']) ? $_SC['charset'] : $_SC['dbcharset'];
        @shell_exec('"' . $mysqlbin . 'mysqldump" --force --quick --default-character-set=' . $_SC['dbcharset'] . ' ' . ($_SGLOBAL['db']->version() > 4.1 ? '--skip-opt --create-options' : '-all') . ' --add-drop-table' . ($extendins == 1 ? '--extended-insert' : '') . '' . ($_SGLOBAL['db']->version() > '4.1' && $sqlcompat == 'MYSQL40' ? '--compatible=mysql40' : '') . ' --host=' . $_SC['dbhost'] . ($_SC['dbport'] ? is_numeric($_SC['dbport']) ? ' --port=' . $_SC['dbport'] : ' --sock=' . $_SC['dbport'] : '') . ' --user=' . $_SC['dbuser'] . ' --password=' . $_SC['dbpw'] . ' ' . $_SC['dbname'] . ' ' . $tablesstr . ' > ' . $dumpfile);
        if (file_exists($dumpfile)) {
            if (is_writable($dumpfile)) {
                $fp = fopen($dumpfile, 'rb+');
                fwrite($fp, $idstring . "# <?exit();?>\n " . $setnames . "\n #");
                fclose($fp);
            }
            if ($usezip) {
                include_once S_ROOT . './source/class_zib.php';
                $zipfilename = $backupfile . '.zip';
                $zipfile = new Zip($zipfilename);
                if ($zipfile->create($dumpfile, PCLZIP_OPT_REMOVE_PATH, S_ROOT . './data/' . $backupdir)) {
                    @unlink($dumpfile);
                    fclose(fopen(S_ROOT . './data/' . $backupdir . '/index.htm', 'a'));
                    cpmessage('successful_data_compression_and_backup_server_to', 'admincp.php?ac=backup');
                } else {
                    cpmessage('backup_file_compression_failure', 'admincp.php?ac=backup');
                }
            } else {
                fclose(fopen(S_ROOT . './data/' . $backupdir . '/index.htm', 'a'));
                cpmessage('successful_data_compression_and_backup_server_to', 'admincp.php?ac=backup');
            }
        } else {
            cpmessage('shell_backup_failure', 'admincp.php?ac=backup');
        }
    }
} elseif ($_GET['op'] == 'import') {
开发者ID:v998,项目名称:discuzx-en,代码行数:31,代码来源:admincp_backup.php

示例3: addslashes

        $dumpfile = $backupfile . '.sql';
        @unlink($dumpfile);
        $mysqlbin = $mysql_base == '/' ? '' : addslashes($mysql_base) . 'bin/';
        $dbcharset = empty($dbcharset) ? $charset : $dbcharset;
        @shell_exec('"' . $mysqlbin . 'mysqldump" --force --quick --default-character-set=' . $dbcharset . ' ' . ($_SGLOBAL['db']->version() > 4.1 ? '--skip-opt --create-options' : '-all') . ' --add-drop-table' . ($extendins == 1 ? '--extended-insert' : '') . '' . ($_SGLOBAL['db']->version() > '4.1' && $sqlcompat == 'MYSQL40' ? '--compatible=mysql40' : '') . ' --host=' . $dbhost . ($dbport ? is_numeric($dbport) ? ' --port=' . $dbport : ' --sock=' . $dbport : '') . ' --user=' . $dbuser . ' --password=' . $dbpw . ' ' . $dbname . ' ' . $tablesstr . ' > ' . $dumpfile);
        if (file_exists($dumpfile)) {
            if (is_writable($dumpfile)) {
                $fp = fopen($dumpfile, 'rb+');
                fwrite($fp, $idstring . "# <?exit();?>\n " . $setnames . "\n #");
                fclose($fp);
            }
            if ($usezip) {
                require_once S_ROOT . './include/zip.lib.php';
                $zipfilename = $backupfile . '.zip';
                $zipfile = new Zip($zipfilename);
                if ($zipfile->create($dumpfile, PCLZIP_OPT_REMOVE_PATH, $datadir . '/' . $backupdir)) {
                    @unlink($dumpfile);
                    fclose(fopen($datadir . '/' . $backupdir . '/index.htm', 'a'));
                    showmessage('database_export_zip_succeed');
                } else {
                    showmessage('database_export_zip_error', $theurl);
                }
            } else {
                fclose(fopen($datadir . '/' . $backupdir . '/index.htm', 'a'));
                showmessage('database_export_succeed');
            }
        } else {
            showmessage('database_shell_faile', $theurl);
        }
    }
}
开发者ID:hongz1125,项目名称:devil,代码行数:31,代码来源:admin_database.php

示例4: fclose

        fclose($fp);
        deltree($datadir . '/' . $backupdir . '/');
        showmessage('file_write_error');
    } else {
        fclose($fp);
        $zipfilearr[] = $tablesqlfile;
    }
    if (!empty($dberrorarr)) {
        deltree($datadir . '/' . $backupdir . '/');
        showmessage($alang['list_table_not_exists'] . implode('<br />', $dberrorarr));
    }
    //´ò°ü
    require_once S_ROOT . './include/zip.lib.php';
    $zipfile = new Zip($backupfile);
    $zipfilestr = implode(',', $zipfilearr);
    $zipfile->create($zipfilestr, PCLZIP_OPT_REMOVE_PATH, $datadir . '/' . $backupdir);
    if (!empty($zipfilearr)) {
        foreach ($zipfilearr as $tmpvalue) {
            @unlink($tmpvalue);
        }
    }
    showmessage('model_export_suc', CPURL . '?action=models&op=import');
} elseif ($_GET['op'] == 'import') {
    if (!ckfounder($_SGLOBAL['supe_uid'])) {
        showmessage('no_authority_management_operation');
    }
    $backupdir = S_ROOT . '/data/model';
    $exportlog = array();
    $_GET['datafile'] = !empty($_GET['datafile']) ? trim($_GET['datafile']) : '';
    $_GET['do'] = !empty($_GET['do']) ? trim($_GET['do']) : '';
    if (empty($_GET['do']) || $_GET['do'] != 'start') {
开发者ID:hongz1125,项目名称:devil,代码行数:31,代码来源:admin_models.php

示例5: temp_zip

 /**
  *
  * @return Zip
  */
 public static function temp_zip()
 {
     return Zip::create(self::temp_file('zip'));
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:8,代码来源:chamilo.class.php

示例6: count

         } else {
             AdminServLogs::add('action', 'Insert map: ' . $map);
         }
     }
 } else {
     if (isset($_POST['downloadMap']) && isset($_POST['map']) && count($_POST['map']) > 0) {
         // Si on télécharge plusieurs fichiers, on envoi un zip
         $countMaps = count($_POST['map']);
         if ($countMaps > 1) {
             $struct = array();
             foreach ($_POST['map'] as $map) {
                 $struct[] = $data['mapsDirectoryPath'] . $map;
             }
             $zipError = null;
             $zipFileName = 'maps.zip';
             if (!Zip::create($zipFileName, $struct, $zipError)) {
                 AdminServ::error($zipError);
             } else {
                 File::download($zipFileName);
                 AdminServLogs::add('action', 'Download packmap (' . $countMaps . ' maps)');
                 if ($result = File::delete($zipFileName) !== true) {
                     AdminServ::error($result);
                 }
             }
         } else {
             File::download($data['mapsDirectoryPath'] . $_POST['map'][0]);
             AdminServLogs::add('action', 'Download map: ' . $_POST['map'][0]);
         }
     } else {
         if (isset($_POST['renameMapValid']) && isset($_POST['map']) && count($_POST['map']) > 0 && isset($_POST['renameMapList']) && count($_POST['renameMapList']) > 0) {
             $i = 0;
开发者ID:keverage,项目名称:adminserv,代码行数:31,代码来源:maps-local.php


注:本文中的Zip::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。