[1071]XOOPS模組開發
<?php
include_once "header.php";
include_once 'class/pclzip.lib.php';
$bak_dir = XOOPS_ROOT_PATH . "/uploads/snews";
$remove_path = XOOPS_ROOT_PATH . "/uploads/";
$bak_file = XOOPS_ROOT_PATH . "/uploads/bak_" . date("YmdHi") . ".zip";
$bak_file_url = XOOPS_URL . "/uploads/bak_" . date("YmdHi") . ".zip";
$zipfile = new PclZip($bak_file);
$zip_list = $zipfile->create($bak_dir, PCLZIP_OPT_REMOVE_PATH, $remove_path);
if ($zip_list == 0) {
die("Error : " . $zipfile->errorInfo(true));
} else {
header("location: {$bak_file_url}");
exit;
}