您好,欢迎访问一九零五行业门户网

php单文件压缩的功能函数的实现

这篇文章介绍的内容是关于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); } $zip->close(); return true; }else{ return false; } }
相关推荐:
php实现解压功能的函数
以上就是php单文件压缩的功能函数的实现的详细内容。
其它类似信息

推荐信息