php 压缩文件
2024-08-22 20:00:39
<?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
最新文章
- protocol buffers vs json vs XML
- Nginx编译参数.md
- sqlserver 插入数据时异常,仅当使用了列列表并且 IDENTITY_INSERT 为 ON 时,才能为表&#39;XXXXX.dbo.XXXXXXXXX&#39;中的标识列指定显式值。
- [异常] VC6.0 error LNK2001: unresolved external symbol _main解决办法
- HDU 4455 Substrings --递推+树状数组优化
- 数据爬取ing
- 实验五实验报告 20135324&;&;20135330
- poj 1833
- Win7+VS2010环境下CEGUI 0.8.4编译过程详解
- C#多线程交替赋值取值
- ARM 汇编器对C的扩展
- CentOS6.4/6.7下Mysql数据库的安装与配置(转载)
- MySQL 一般查询日志(General Query Log)
- 基于Spring MVC 实现拦截器
- L3-2 森森快递 (30 分)(贪心+线段树/分块)
- Codeforces 919D Substring 【拓扑排序】+【DP】
- Spring源码学习资料
- vscode 常用扩展推荐
- Centos 6.5(64位) vim 8.0 安装
- Excel2010隔行变色的实现方法 [也可套用格式即可]
热门文章
- Computational biological hypothesis generation using ";-omics"; data
- 网页包抓取工具Fiddler工具简单设置
- iOS - WWDC18 iOS 自动生成强密码和自动填充验证码/密码
- Vue2.0的核心思想
- [C#(WinForm)]判断第一次启动程序
- 浅析MySQL使用 GROUP BY 分组聚合与细分聚合
- python中 ";is";和";==";的区别
- java安全相关知识
- yum 异常解决一例
- IDEA实用教程(六)—— 全局设置的两种方式