<?php
$zip = new ZipArchive;
$myfile = fopen("test.zip", "w");
chmod("test.zip",);
if ($zip->open('test.zip') === TRUE) {
$zip->addFile('/Library/WebServer/Documents/ibarn/data/01/20190728/17d5942b1b9b2515b883d5d0ea60f34a.xlsx', '17d5942b1b9b2515b883d5d0ea60f34a.xlsx');
$zip->close();
echo 'ok';
} else {
echo 'failed';
}
?>

输出

ok

参考:

https://www.php.net/manual/en/ziparchive.addfile.php

https://blog.csdn.net/qq_38794041/article/details/81483739

https://www.w3school.com.cn/php/func_filesystem_chmod.asp

https://www.w3school.com.cn/php/php_file_create.asp

最新文章

  1. protocol buffers vs json vs XML
  2. Nginx编译参数.md
  3. sqlserver 插入数据时异常,仅当使用了列列表并且 IDENTITY_INSERT 为 ON 时,才能为表&#39;XXXXX.dbo.XXXXXXXXX&#39;中的标识列指定显式值。
  4. [异常] VC6.0 error LNK2001: unresolved external symbol _main解决办法
  5. HDU 4455 Substrings --递推+树状数组优化
  6. 数据爬取ing
  7. 实验五实验报告 20135324&amp;&amp;20135330
  8. poj 1833
  9. Win7+VS2010环境下CEGUI 0.8.4编译过程详解
  10. C#多线程交替赋值取值
  11. ARM 汇编器对C的扩展
  12. CentOS6.4/6.7下Mysql数据库的安装与配置(转载)
  13. MySQL 一般查询日志(General Query Log)
  14. 基于Spring MVC 实现拦截器
  15. L3-2 森森快递 (30 分)(贪心+线段树/分块)
  16. Codeforces 919D Substring 【拓扑排序】+【DP】
  17. Spring源码学习资料
  18. vscode 常用扩展推荐
  19. Centos 6.5(64位) vim 8.0 安装
  20. Excel2010隔行变色的实现方法 [也可套用格式即可]

热门文章

  1. Computational biological hypothesis generation using &quot;-omics&quot; data
  2. 网页包抓取工具Fiddler工具简单设置
  3. iOS - WWDC18 iOS 自动生成强密码和自动填充验证码/密码
  4. Vue2.0的核心思想
  5. [C#(WinForm)]判断第一次启动程序
  6. 浅析MySQL使用 GROUP BY 分组聚合与细分聚合
  7. python中 &quot;is&quot;和&quot;==&quot;的区别
  8. java安全相关知识
  9. yum 异常解决一例
  10. IDEA实用教程(六)—— 全局设置的两种方式