您现在的位置是:网站首页>PHPPHP
PHP的ZIP压缩文件方法(单文件)
左鹏07-01 10:29:19【PHP】4,443人已围观
简介需要开启php.ini的ZIP支持open($destination,$overwrite ? ZIPARCHIVE::OVERWRITE : ZIPARCHIVE::CREATE) !== true) { return false; } //add the files //向压缩文件中添加文件 foreach($valid_files as $fi
需要开启php.ini的ZIP支持
open($destination,$overwrite ? ZIPARCHIVE::OVERWRITE : ZIPARCHIVE::CREATE) !== true) { return false; } //add the files //向压缩文件中添加文件 foreach($valid_files as $file) { $file_info_arr= pathinfo($file); $filename =$file_info_arr['basename']; $zip->addFile($file,$filename); } //debug //echo 'The zip archive contains ',$zip->numFiles,' files with a status of ',$zip->status; //close the zip -- done! //关闭文件 $zip->close(); //check to make sure the file exists //检测文件是否存在 return file_exists($destination); }else{ //如果没有真实有效的文件返回false return false; } }
上一篇:PHP字符串按位异或
下一篇:《致父亲》 (上)
点击排行

本栏推荐

猜你喜欢
站点信息
- 建站时间:2018-09-18
- 网站程序:Spring Boot
- 主题模板:《今夕何夕》
- 文章统计:104条
- 微信公众号:扫描二维码,关注我们
