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


PHP zip函数代码示例

本文整理汇总了PHP中zip函数的典型用法代码示例。如果您正苦于以下问题:PHP zip函数的具体用法?PHP zip怎么用?PHP zip使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: displayMainPageCategories

function displayMainPageCategories($data)
{
    $categories = DBHelper::verticalSlice($data, "name");
    $numbers = range(1, count($categories));
    $width = 100 / count($categories) . '%%';
    $arr = zip($numbers, $categories);
    $start = '<div class="section group">';
    $fmt = '<div data-tab="%d" class="tab-items col main-tabs" style="width: ' . $width . '"><div id="tabLabel">%s</div></div>';
    $end = '</div>';
    return htmlLoop($arr, $start, $fmt, $end);
}
开发者ID:soengle,项目名称:BringIt,代码行数:11,代码来源:phpToHTML.php

示例2: backupF

 private function backupF()
 {
     $b_name = 'backup_' . date("Y-m-d_H-i-s") . '.zip';
     if (zip(dirname(getcwd()), '../upload/files/' . $b_name)) {
         header('Content-Type: application/zip');
         header('Content-Disposition: attachment; filename="' . $b_name . '"');
         header('Cache-Control: max-age=0');
         readfile('../upload/files/' . $b_name);
         exit;
     }
 }
开发者ID:wharin,项目名称:quantum,代码行数:11,代码来源:control.php

示例3: goapk

function goapk($file)
{
    exec("del bbshenqi.zip");
    exec("del bbshenqi.apk");
    exec("del gosign.bat");
    exec("del D:\\android\\apk\\bbshenqi\\assets\\unionid.txt");
    exec("copy /Y demo.bat gosign.bat");
    file_content_replace("gosign.bat", "00000.apk", $file . '.apk');
    exec('echo ' . $file . '>D:\\android\\apk\\bbshenqi\\assets\\unionid.txt');
    zip("bbshenqi", "bbshenqi.zip");
    exec("copy /Y bbshenqi.zip bbshenqi.apk");
    exec("gosign.bat");
}
开发者ID:vb2005xu,项目名称:automake-apk-php,代码行数:13,代码来源:markapk.php

示例4: zip

 function zip($srcdir, $webdir, $zip, $srcdirvlu)
 {
     $dir = opendir($srcdir);
     while (false !== ($file = readdir($dir))) {
         if ($file != '.' && $file != '..') {
             if (is_dir($srcdir . $file)) {
                 $filepath = str_replace($srcdirvlu, '', $srcdir . $file);
                 zip($srcdir . $file . '/', $filepath . '/', $zip, $srcdirvlu);
             } else {
                 $zip->addFile($srcdir . $file, $webdir . $file);
             }
         }
     }
     closedir($dir);
 }
开发者ID:appsystem,项目名称:appmoney712-app-creation-system-phpbuiltinserver,代码行数:15,代码来源:zip.php

示例5: str_replace

mystep;
            $result = str_replace("/*--settings--*/", makeVarsCode($setting_sub, '$setting_sub'), $result);
            WriteFile(ROOT_PATH . "/include/config_" . $_POST['idx'][$i] . ".php", $result, "w");
        }
        $idx = "";
        break;
    case "export":
        $log_info = $setting['language']['admin_web_template_export'];
        require ROOT_PATH . "/source/class/myzip.class.php";
        $dir = ROOT_PATH . "/" . $setting['path']['upload'] . "/tmp/";
        $zipfile = $dir . "template_" . $idx . ".zip";
        @unlink($zipfile);
        $files = array();
        $files[] = $tpl_path . $idx . "/";
        $files[] = ROOT_PATH . "/images/" . $idx . "/";
        if (zip($files, $zipfile, ROOT_PATH . "/")) {
            $content = file_get_contents($zipfile);
            header("Content-type: application/zip");
            header("Accept-Ranges: bytes");
            header("Accept-Length: " . strlen($content));
            header("Content-Disposition: attachment; filename=" . getSafeCode("template_" . $idx . ".zip", "utf-8"));
            echo $content;
        } else {
            showInfo($setting['language']['admin_web_template_export_error']);
        }
        break;
    case "upload":
        $log_info = $setting['language']['admin_web_template_upload'];
        if (count($_POST) > 0) {
            $path_upload = $setting['path']['upload'] . "/tmp/" . date("Ym") . "/";
            $upload = new MyUploader();
开发者ID:laiello,项目名称:mystep-cms,代码行数:31,代码来源:web_template.php

示例6: elseif

     }
 } elseif (isset($_GP['touchok'])) {
     $s_datenew = strtotime($_GP['touchok']);
     foreach ($s_lists as $s_l) {
         if (touch($s_l, $s_datenew)) {
             $s_counter++;
         }
     }
     if ($s_counter > 0) {
         $s_result .= notif($s_counter . " items changed access and modification time to " . @date("d-M-Y H:i:s", $s_datenew));
     } else {
         $s_result .= notif("No items modified");
     }
 } elseif (isset($_GP['compresszipok'])) {
     $s_file = $_GP['compresszipok'];
     if (zip($s_lists, $s_file)) {
         $s_result .= notif("Archive created : " . hss($s_file));
     } else {
         $s_result .= notif("Error creating archive file");
     }
 } elseif (isset($_GP['compresstarok'])) {
     $s_lists_ = array();
     $s_file = $_GP['compresstarok'];
     $s_file = basename($s_file);
     $s_lists__ = array_map("basename", $s_lists);
     $s_lists_ = array_map("pf", $s_lists__);
     exe("tar cf \"" . $s_file . "\" " . implode(" ", $s_lists_));
     if (@is_file($s_file)) {
         $s_result .= notif("Archive created : " . hss($s_file));
     } else {
         $s_result .= notif("Error creating archive file");
开发者ID:engmohamedamer,项目名称:gotest,代码行数:31,代码来源:dl.php

示例7: ss

 $dltype = ss($_REQUEST['dltype']);
 $dlpath = ss($_REQUEST['dlpath']);
 $dlname = basename($dlpath);
 if ($dlpath == ".") {
     $dlname = basename($cwd);
 } elseif ($dlpath == "..") {
     chdir("..");
     $dlname = basename(getcwd());
     chdir($cwd);
 }
 $tmpdir = get_writabledir();
 $dlarchive = $tmpdir . $dlname;
 $dlthis = "";
 if ($dltype == "ziparchive") {
     $dlarchive .= ".zip";
     if (zip($dlpath, $dlarchive)) {
         $dlthis = $dlarchive;
     }
 } elseif ($dltype == "tar") {
     $dlarchive .= ".tar";
     $dlarchive = str_replace('\\', '/', $dlarchive);
     exe("tar cf " . $dlarchive . " " . $dlpath);
     $dlthis = $dlarchive;
 } elseif ($dltype == "targz") {
     $dlarchive .= ".tar.gz";
     $dlarchive = str_replace('\\', '/', $dlarchive);
     exe("tar czf " . $dlarchive . " " . $dlpath);
     $dlthis = $dlarchive;
 } elseif ($dltype == "raw") {
     if (is_file($dlpath)) {
         $dlthis = $dlpath;
开发者ID:retanoj,项目名称:webshellSample,代码行数:31,代码来源:45286f060073a61bcef5e330311a00b8.php

示例8: compress

 function compress($type, $archive, $files)
 {
     if (!is_array($files)) {
         $files = array($files);
     }
     if ($type == 'zip') {
         if (zip($files, $archive)) {
             return true;
         } else {
             return false;
         }
     } elseif ($type == 'tar' || $type == 'targz') {
         $archive = basename($archive);
         $listsBasename = array_map("basename", $files);
         $lists = array_map("wrap_with_quotes", $listsBasename);
         if ($type == 'tar') {
             execute("tar cf \"" . $archive . "\" " . implode(" ", $lists));
         } elseif ($type == 'targz') {
             execute("tar czf \"" . $archive . "\" " . implode(" ", $lists));
         }
         if (is_file($archive)) {
             return true;
         } else {
             return false;
         }
     }
     return false;
 }
开发者ID:retanoj,项目名称:webshellSample,代码行数:28,代码来源:7394316867fbf40088309b5150e77721.php

示例9: isset

    return $zip->close();
}
$manual = isset($_GET['manual']) ? $_GET['manual'] === 'true' ? true : false : false;
$sourcecode = isset($_GET['sourcecode']) ? $_GET['sourcecode'] === 'true' ? true : false : false;
$bootstrap = isset($_GET['bootstrap']) ? $_GET['bootstrap'] === 'true' ? true : false : false;
$jquery = isset($_GET['jquery']) ? $_GET['jquery'] === 'true' ? true : false : false;
$array = array();
$filename_begin = 'OSS_Web_Development_Workshop(';
$filename = array();
$filename_end = ').zip';
if ($manual) {
    $array[] = 'manual.pptx';
    $filename[] = 'manual';
}
if ($sourcecode) {
    $array[] = 'static/';
    $array[] = 'download.php';
    $array[] = 'get.php';
    $array[] = 'index.php';
    $filename[] = 'sourcecode';
}
if ($bootstrap) {
    $array[] = 'bootstrap/';
    $filename[] = 'bootstrap';
}
if ($jquery) {
    $array[] = 'jquery/';
    $filename[] = 'jquery';
}
zip($array, './cache/' . $filename_begin . implode(', ', $filename) . $filename_end, dirname(__FILE__));
header('Location: /cache/' . $filename_begin . implode(', ', $filename) . $filename_end);
开发者ID:pvtuan10,项目名称:Workshops,代码行数:31,代码来源:get.php

示例10: rar

     require CLASS_DIR . 'options/rar.php';
     rar();
     break;
 case 'rar_go':
     if (!empty($options['disable_rar'])) {
         break;
     }
     require CLASS_DIR . 'options/rar.php';
     rar_go();
     break;
 case 'zip':
     if (!empty($options['disable_zip'])) {
         break;
     }
     require CLASS_DIR . 'options/zip.php';
     zip();
     break;
 case 'zip_go':
     if (!empty($options['disable_zip'])) {
         break;
     }
     require CLASS_DIR . 'options/zip.php';
     zip_go();
     break;
 case 'pack':
     if (!empty($options['disable_tar'])) {
         break;
     }
     require CLASS_DIR . 'options/pack.php';
     rl_pack();
     break;
开发者ID:mewtutorial,项目名称:RapidTube,代码行数:31,代码来源:options.php

示例11: date

 $log_info = $setting['language']['admin_func_backup_export'];
 $dir = ROOT_PATH . "/" . $setting['path']['upload'] . "/tmp/";
 if ($table_name == "all") {
     require ROOT_PATH . "/source/class/myzip.class.php";
     $zipfile = $dir . date("Ymd") . "_db_all.zip";
     $dir = $dir . date("Ymd") . "_db_all/";
     $tbl_list = $db->GetTabs($setting['db']['name']);
     $max_count = count($tbl_list);
     $files = array();
     for ($i = 0; $i < $max_count; $i++) {
         $content = "DROP TABLE IF EXISTS `{$tbl_list[$i]}`;\n\n";
         $content .= $db->GetTabSetting($tbl_list[$i], $setting_sub['db']['name']) . "\n" . $db->GetTabData($setting_sub['db']['name'] . "." . $tbl_list[$i]);
         $files[$i] = $dir . $setting_sub['db']['name'] . "_" . $tbl_list[$i] . ".sql";
         WriteFile($files[$i], $content);
     }
     zip($files, $zipfile, $dir);
     header("Content-type: application/zip");
     header("Accept-Ranges: bytes");
     header("Accept-Length: " . filesize($zipfile));
     header("Content-Disposition: attachment; filename=" . basename($zipfile));
     $content = GetFile($zipfile);
     MultiDel($dir);
     unlink($zipfile);
 } else {
     $content = "DROP TABLE IF EXISTS `{$table_name}`;\n\n";
     $content .= $db->GetTabSetting($table_name) . "\n" . $db->GetTabData($table_name);
     header("Content-type: text/plain");
     header("Accept-Ranges: bytes");
     header("Accept-Length: " . strlen($content));
     header("Content-Disposition: attachment; filename=" . date("Ymd") . "_db_{$table_name}.sql");
 }
开发者ID:laiello,项目名称:mystep-cms,代码行数:31,代码来源:func_backup.php

示例12: header

        }
    }
    header('location:index.php?p=admin&token=' . TOKEN);
    exit;
}
# zip multiselection
if (!empty($_POST['item']) && !empty($_POST['multiselect_command']) && $_POST['multiselect_command'] == 'zip' && $_SESSION['zip']) {
    $zipfile = $_SESSION['temp_folder'] . 'Bozon_pack' . date('d-m-Y h-i-s') . '.zip';
    $file_list = array();
    foreach ($_POST['item'] as $key => $item) {
        $file_list[] = id2file($item);
    }
    if (!is_dir($_SESSION['temp_folder'])) {
        mkdir($_SESSION['temp_folder']);
    }
    zip($file_list, $zipfile);
    header('location: ' . $zipfile);
    exit;
}
# Lock folder with password
if (!empty($_POST['pass']) && !empty($_POST['id']) && !empty($_POST['confirm']) && is_owner($_POST['id']) && $_POST['confirm'] == $_POST['pass']) {
    $id = $_POST['id'];
    $file = id2file($id);
    $password = blur_password($_POST['pass']);
    # turn normal share id into password hashed id
    $ids = unstore();
    unset($ids[$id]);
    $ids[$password . $id] = $file;
    store($ids);
    header('location:index.php?p=admin&token=' . TOKEN);
    exit;
开发者ID:Pluxopolis,项目名称:BoZoN,代码行数:31,代码来源:GET_POST_admin_data.php

示例13: count

         $m = count($list);
         if ($m > 0) {
             require ROOT_PATH . "/source/class/myzip.class.php";
             $dir = ROOT_PATH . "/" . $setting['path']['upload'] . "/tmp/";
             $zipfile = $dir . "update_" . date("Ymd") . ".zip";
             @unlink($zipfile);
             $dir = $dir . "update/" . date("Ymd/");
             $files = array();
             for ($i = 0; $i < $m; $i++) {
                 if ($update_info['content'][$list[$i]] == ".") {
                     continue;
                 }
                 $files[$i] = $dir . $update_info['file'][$list[$i]];
                 WriteFile($files[$i], $update_info['content'][$list[$i]], "wb");
             }
             if (zip($files, $zipfile, $dir)) {
                 $link = $setting['web']['url'] . "/" . $setting['path']['upload'] . "/tmp/" . basename($zipfile);
             }
             MultiDel($dir);
         }
     }
     echo $link;
     break;
 default:
     $header = array();
     $header['Referer'] = "http://" . $req->GetServer("HTTP_HOST");
     $header['ms_sign'] = $setting['web']['sign'];
     $check_info = GetRemoteContent($setting['gen']['update'] . "?m=check&v=" . $ms_version['ver'] . "&cs=" . $setting['gen']['charset'], $header);
     $check_info = chg_charset($check_info, "utf-8", $setting['gen']['charset']);
     echo $check_info;
     break;
开发者ID:laiello,项目名称:mystep-cms,代码行数:31,代码来源:update.php

示例14: db_delete

/**
* "Deletes" a database: makes a .sql dump of the database content
* and zips all files related to this db.
*
* @param mixed $db Database name WITHOUT hdb extension
*/
function db_delete($db, $verbose = true)
{
    if (db_dump($db)) {
        // Create DELETED_DATABASES directory if needed
        $folder = HEURIST_UPLOAD_ROOT . "DELETED_DATABASES/";
        if (!file_exists($folder)) {
            mkdir($folder, 0777, true);
        }
        // Zip $source to $file
        $source = HEURIST_UPLOAD_ROOT . $db;
        $destination = $folder . $db . "_" . time() . ".zip";
        if (zip($source, $destination)) {
            // Delete $source folder
            deleteFolder($source);
            if ($verbose) {
                echo "<br/>Folder " . $source . " has been deleted";
            }
            // Delete from MySQL
            $mysqli = server_connect();
            $mysqli->query("DROP DATABASE hdb_" . $db);
            $mysqli->close();
            if ($verbose) {
                echo "<br/>Database " . $db . " has been dropped";
            }
            return true;
        } else {
            if ($verbose) {
                echo "<br/>Failed to zip " . $source . " to " . $destination;
            }
        }
    } else {
        if ($verbose) {
            echo "<br/>Failed to dump database " . $db . " to a .sql file";
        }
    }
    return false;
}
开发者ID:HeuristNetwork,项目名称:heurist,代码行数:43,代码来源:dbUtils.php

示例15: d

d('# Dependencies');
$result->composer = copyDependencyToBuild('/composer');
i($result->composer, 'composer');
$result->o80 = copyDependencyToBuild('/o80/i18n/src');
i($result->o80, 'o80-i18n');
$result->smarty = copyDependencyToBuild('/smarty/smarty/libs');
i($result->smarty, 'smarty');
$result->autoload = @copy(VENDOR . '/autoload.php', BUILD_VENDOR . '/autoload.php');
i($result->autoload, 'autoload');
// Copy assets
d('# Assets');
copyFiles(array('css', 'fonts', 'images', 'js'), $result);
// Copy sources
d('# Source directories');
copyFiles(array('admin', 'app', 'locale', 'tpl'), $result);
d('# Source files');
$files = array('adminstuds.php', 'bandeaux.php', 'create_classic_poll.php', 'create_date_poll.php', 'create_poll.php', 'exportcsv.php', 'favicon.ico', 'htaccess.txt', 'index.php', 'INSTALL.md', 'LICENCE.fr.txt', 'LICENSE.en.txt', 'maintenance.php', 'php.ini', 'README.md', 'robots.txt', 'studs.php');
copyFiles($files, $result);
// Zip Dist
$output = DIST . '/framadate-' . VERSION . '-' . date('Ymd') . '.zip';
zip(BUILD, $output);
rrmdir(BUILD);
if (isset($_GET['verbose'])) {
    var_dump($result);
}
d('--------');
d('Distribution file: ' . realpath($output));
$generatedIn = round(microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'], 4);
d('========');
d('Generated in: ' . $generatedIn . ' secondes');
echo '</pre>';
开发者ID:blr21560,项目名称:framadate,代码行数:31,代码来源:packaging.php


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