当前位置:网站首页>PHP compressed file
PHP compressed file
2022-06-25 21:16:00 【Dawu Xiaodong】
<?php
$zip = new ZipArchive();
$filename = "/tmp/test112.zip";
if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
exit("cannot open <$filename>\n");
}
$basePath='/tmp/test';
if ($dh = opendir($basePath)){
while (($file = readdir($dh)) !== false){
if($file!='.' && $file!='..'){
$zip->addFile( $basePath.'/'.$file);
}
}
}
$zip->addFromString("testfilephp.txt","#1 This is a test string added as testfilephp.txt.\n");
$zip->addFromString("testfilephp2.txt","#2 This is a test string added as testfilephp2.txt.\n");
$zip->addFile( "/tmp/test/t.php");
echo "numfiles: " . $zip->numFiles . "\n";
echo "status:" . $zip->status . "\n";
$zip->close();This is just a layer of file directories traversed
边栏推荐
- Node installation method you don't know
- On ACM competition
- Nine built-in objects of JSP and four scopes of Servlet
- Talking about the foundation of function test today
- Idea implements hot deployment
- 同花顺app是正规的吗?到底安不安全
- Feature Engineering in simple terms – a practice guide based on openmldb (Part 1)
- Docker failed to remotely access 3306 after installing MySQL
- Is it safe for qiniu school to open an account in 2022?
- couldn‘t be accessed by user ‘_ apt‘
猜你喜欢
8 minutes to understand the wal mechanism of tdengine

Finger collar pin exclusive Medal
Section 13: simplify your code with Lombok
Uncover n core 'black magic' of Presto + alluxio

What is a subnet mask? (Powercert animated videos)

Using two stacks to realize the function of one queue?
Online yaml to XML tool

Cvpr2020 | the latest cvpr2020 papers are the first to see, with all download links attached!

Summary of several methods for FPS calculation

What is a server? (Powercert animated videos)
随机推荐
Desktop network error display red ×, Component failed to start
[nailing scenario capability package] smart office phone
Flexible scale out: from file system to distributed file system
Svn various color states
Mutual conversion of CString and char*
Node connection MySQL
[buucry] sensor (Manchester code)
Talking about the foundation of function test today
The beginning of manjaro's journey
What is a server? (Powercert animated videos)
C language dynamic memory allocation
New generation engineers teach you how to play with alluxio + ml (Part 2)
[important notice] developer document update (12.13-12.19)
Boomfilter learning
What is a subnet mask? (Powercert animated videos)
HMS core actively explores the function based on hardware ear return, helping to reduce the overall singing delay rate of the singing bar by 60%
Is flush app regular? Is it safe or not
Is it safe for qiniu school to open an account in 2022?
OLED driver learning based on ssd1306 (I): SSD Chinese command table (handling)
This is a simple and cool way to make large screen chart linkage. Smartbi will teach you