当前位置:网站首页>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
边栏推荐
- OLED driven learning based on ssd1306 (II): addressing mode of ssd1306
- Mysqldumpslow out slow statements in the database
- [opencv] opencv from introduction to mastery -- detailed explanation of input and output XML and yaml files
- Finger collar pin exclusive Medal
- Node installation method you don't know
- Vbpr (visual Bayesian personalized ranking) paper summary
- How to play one to many in JPA?
- Installing mysql8 under centos8
- C language dynamic memory allocation
- Heavy update! Yolov4 latest paper! Interpreting yolov4 framework
猜你喜欢
js (1)
After 20 days' interview, I finally joined Ali (share the interview process)
"Developer theory" multi system integrated development - rapid nailing of enterprise owned systems
[nail scenario capability package] hospital visitor verification
Finger collar pin exclusive Medal
[nailing scenario capability package] company / Park Digital canteen
UDP Vs TCP (Powercert animated videos)
Idea implements hot deployment
[nailing - scenario capability package] nailer card
1.0-mq getting started and using
随机推荐
Sqlmap for interface security testing
Tencent music knowledge map search practice
Insert and update each database
The beginning of manjaro's journey
Openocd compilation and installation
What is a server? (Powercert animated videos)
R language momentum and Markowitz portfolio model implementation
Basic process of configuring utf8 in idea
Yolov4 improved version comes out! Yolov4 extended edition! Yolov4 launched scaled-yolov4: scaling cross stage partial network
JS__ Prototype, prototype chain, call/apply__ Duyi
The SH runtime directly reported an error syntax error near unexpected token ` $'. \r‘
Installing mysql8 under centos8
STM32 self balancing robot project, with code, circuit diagram and other data attached at the end (learning materials and learning group at the end)
Soft test intermediate simple notes
Getting started and using postman
COMP9024
UDP Vs TCP (Powercert animated videos)
[machine learning] machine learning from zero to mastery -- teach you to understand the principle of decision tree
05 configuring network parameters
炒股票用指南针安全还是用证券软件安全?哪里可以开户怎么开