最新php压缩zip函数
以下是三零网为大家整理的最新php压缩zip函数的文章,希望大家能够喜欢!
//代码来自: www.
function emZip($orig_fname, $content) {
if (!class_exists('ZipArchive', FALSE)) {
return false;
}
$zip = new ZipArchive();
$tempzip = EMLOG_ROOT .
'/content/cache/emtemp.zip';
$res = $zip->open($tempzip,
ZipArchive::CREATE);
if ($res === TRUE) {
$zip->addFromString($orig_fname,
$content);
$zip->close();
$zip_content =
file_get_contents($tempzip);
unlink($tempzip);
return $zip_content;
} else {
return false;
}
}
延伸阅读:
·php对base64编码文件进行解码,解压缩示例
·php利用zlib链接库压缩和解压缩swf文件
·PHP使用base64+gzinflate实现压缩编码和解码
·PHP实现的ZIP文件操作类
·apache环境实现php 开启 gzip压缩
·PHP全站静态HTML文件GZIP压缩传输.htaccess设置
·PHP浅析HTTP方式的Gzip压缩传输方法
·php实现图片添加水印,压缩,剪切的封装类实现
·PHP图片水印、压缩、剪切的封装类
·PHP生成ZIP压缩文件示例
·YUI+Ant 实现JS+CSS压缩示例
·php批量压缩图片示例
·ThinkPHP将文件打包zip并下载示例
·CI框架自带的zip类简单实用
·PHP开启Gzip并实现Gzip示例
转载自:http://www./list3/list117/794.html
|