本文整理汇总了PHP中zipfile::store方法的典型用法代码示例。如果您正苦于以下问题:PHP zipfile::store方法的具体用法?PHP zipfile::store怎么用?PHP zipfile::store使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zipfile
的用法示例。
在下文中一共展示了zipfile::store方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sprintf
} else {
$context['text'] .= '<p>' . sprintf(i18n::s('Meta data have been saved in %s'), $context['path_to_reference'] . 'footprints.php') . "</p>\n";
// also put the file in the archive
$references[] = array('', 'footprints.php');
}
// also update our own version
Safe::file_put_contents($context['path_to_root'] . 'footprints.php', $content);
// splash message
$context['text'] .= '<p>' . i18n::s('On-going archive preparation...') . "\n";
$file_path = $context['path_to_reference'];
$file_name = 'temporary/' . gmdate("Ymd") . '_yacs_' . trim($_REQUEST['version']);
// start the zip file
include_once '../shared/zipfile.php';
$zipfile = new zipfile();
// place all files into a single directory --fixed time to allow cacheability
$zipfile->store('yacs/', 0);
// process every reference file
$all_files = array();
$index = 0;
foreach ($references as $reference) {
// let's go
list($path, $file) = $reference;
if (strlen(trim($path)) > 0) {
$file = $path . '/' . $file;
}
// read file content
if (($content = Safe::file_get_contents($file_path . $file)) !== FALSE) {
// compress textual content
if ($content && preg_match('/\\.(css|htc|htm|html|include|js|mo|php|po|pot|sql|txt|xml)$/i', $file)) {
$zipfile->deflate('yacs/' . $file, Safe::filemtime($file_path . $file), $content);
} else {
示例2: zipfile
include_once '../shared/zipfile.php';
$zipfile = new zipfile();
// process every skin/current_skin/ file
$index = 0;
foreach ($datafiles as $datafile) {
// let's go
list($path, $filename) = $datafile;
if ($path) {
$file = $path . '/' . $filename;
} else {
$file = $filename;
}
// read file content
if (($content = Safe::file_get_contents($file_prefix . $file)) !== FALSE) {
// store binary data
$zipfile->store($file, Safe::filemtime($file_prefix . $file), $content);
// avoid timeouts
if (!($index++ % 50)) {
Safe::set_time_limit(30);
SQL::ping();
}
}
}
// suggest a download
Safe::header('Content-Type: application/zip');
Safe::header('Content-Disposition: attachment; filename="backup_' . $context['skin'] . '.zip"');
// send the archive content
echo $zipfile->get();
// do not allow for regular rendering
return;
// no file