本文整理汇总了PHP中PHPZip::file方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPZip::file方法的具体用法?PHP PHPZip::file怎么用?PHP PHPZip::file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPZip
的用法示例。
在下文中一共展示了PHPZip::file方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: while
while ($row_www_com = $GLOBALS['db']->fetchRow($res_www_com)) {
$user_value['user_name'] = $row_www_com['user_name'];
$user_value['email'] = $row_www_com['email'];
/* 处理会员等级 */
$user_value['user_rank'] = " ";
if ($row_www_com['user_rank']) {
$user_value['user_rank'] = $rank_list_www_com[$row_www_com['user_rank']];
} else {
foreach ($rank_list_www_com[0] as $rank_temp) {
if ($row_www_com['rank_points'] >= $rank_temp['min_points'] and $row_www_com['rank_points'] < $rank_temp['max_points']) {
$user_value['user_rank'] = $rank_temp['rank_name'];
break;
}
}
}
/* 处理电话(家庭电话、办公电话) */
$user_value['tel_phone'] = $row_www_com['home_phone'];
$user_value['tel_phone'] .= !empty($row_www_com['home_phone']) && !empty($row_www_com['office_phone']) ? "或" : "";
$user_value['tel_phone'] .= $row_www_com['office_phone'];
$user_value['mobile_phone'] = $row_www_com['mobile_phone'];
$content .= implode(",", $user_value) . "\n";
}
if (EC_CHARSET == 'utf-8') {
$zip->add_file(ecs_iconv('UTF8', 'GB2312', $content), 'users_list.csv');
} else {
$zip->add_file($content, 'goods_list.csv');
}
header("Content-Disposition: attachment; filename=users_list.zip");
header("Content-Type: application/unknown");
die($zip->file());
}
示例2: sAjax
@fclose($fp);
sAjax('OK');
} else {
sAjax(tText('accessdenied', 'Access denied'));
}
}
break;
case 'comp':
if ($p['dl']) {
$zip = new PHPZip();
$zip->Zipper($p['fl'], $p['dl']);
header('Content-Type: application/octet-stream');
header('Accept-Ranges: bytes');
header('Accept-Length: ' . strlen($compress));
header('Content-Disposition: attachment;filename=' . $_SERVER['HTTP_HOST'] . '_' . date('Ymd-His') . '.zip');
echo $zip->file();
exit;
}
break;
case 'copy':
if ($p['dl']) {
$fNames = array();
$total = count($p['dl']);
if ($p['b'][strlen($p['b']) - 1] !== DS) {
$p['b'] .= DS;
}
for ($z = 0; $total > $z; $z++) {
$fileinfo = pathinfo($p['fl'] . $p['dl'][$z]);
if (!file_exists($p['fl'] . $p['dl'][$z])) {
sAjax(tText('notexist', 'Object does not exist'));
} else {