本文整理汇总了PHP中PHPZip::zip方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPZip::zip方法的具体用法?PHP PHPZip::zip怎么用?PHP PHPZip::zip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPZip
的用法示例。
在下文中一共展示了PHPZip::zip方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: date
}
} else {
make_json_error($db->error());
}
}
/*------------------------------------------------------ */
//-- 备份模版
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'backup') {
check_authz_json('backup_setting');
include_once 'includes/cls_phpzip.php';
$tpl = $_CFG['template'];
//$tpl = trim($_REQUEST['tpl_name']);
$filename = '../temp/backup/' . $tpl . '_' . date('Ymd') . '.zip';
$zip = new PHPZip();
$done = $zip->zip('../themes/' . $tpl . '/', $filename);
if ($done) {
make_json_result($filename);
} else {
make_json_error($_LANG['backup_failed']);
}
}
/*------------------------------------------------------ */
//-- 载入指定库项目的内容
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'load_library') {
$library = load_library($_CFG['template'], trim($_GET['lib']));
$message = $library['mark'] & 7 ? '' : $_LANG['library_not_written'];
make_json_result($library['html'], $message);
}
/*------------------------------------------------------ */
示例2: substr
$templates['dir'] = substr($_CFG['template_dir'], 0, -1);
$templates['info'] = get_templates_info("../templates/" . $templates['dir'] . "/info.txt");
$smarty->assign('templates', $templates);
$smarty->assign('navlabel', "list");
$smarty->display('tpl/admin_templates_list.htm');
} elseif ($act == 'backup') {
check_token();
check_permissions($_SESSION['admin_purview'], "tpl_backup");
require_once ADMIN_ROOT_PATH . 'include/admin_phpzip.php';
$tpl = trim($_REQUEST['tpl_name']);
if (dirname($tpl) != '.') {
adminmsg("操作失败!", 0);
}
$filename = '../temp/backup_templates/' . $tpl . '_' . date('Ymd') . '.zip';
$zip = new PHPZip();
$done = $zip->zip('../templates/' . $tpl . '/', $filename);
if ($done) {
header("Location:" . $filename . "");
} else {
adminmsg("操作失败!", 0);
}
} elseif ($act == 'set') {
check_token();
check_permissions($_SESSION['admin_purview'], "tpl_edit");
$templates_info = get_templates_info("../templates/" . trim($_REQUEST['tpl_dir']) . "/info.txt");
$tpl_dir = trim($_REQUEST['tpl_dir']) . "/";
!$db->query("UPDATE " . table('config') . " SET value='{$tpl_dir}' WHERE name='template_dir'") ? adminmsg('设置失败', 1) : "";
refresh_cache("config");
$dir = "../temp/templates_c/" . $tpl_dir;
if (!file_exists($dir)) {
mkdir($dir);