这篇文章介绍的内容是关于php单文件压缩的功能函数的实现,递归正确写法 ,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下
function zip_file(string $filename){ if(!is_file($filename)){ return false; } $zip=new ZipArchive(); $zipName=basename($filename).'.zip'; //打开指定压缩包,不存在则创建,存在则覆盖 if($zip->open($zipName,ZipArchive::CREATE|ZipArchive::OVERWRITE)){ //将文件添加到压缩包中 if($zip->addFile($filename)){ @unlink($filename); <span>@本文来*源gaodai#ma#com搞*!代#%^码$网*</span><textarea>搞gaodaima代码</textarea> } $zip->close(); return true; }else{ return false; }}
相关推荐:
php实现解压功能的函数
以上就是php单文件压缩的功能函数的实现的详细内容,更多请关注搞代码gaodaima其它相关文章!