However, there are no functions for folder operations in the zlib library (of course, we can also write one ourselves, but this is too troublesome), we can download it online There are some ready-made tools written by predecessors that extend the zlib function library.
The specific implementation code of PHP compressed folder:
- < ?php
- require_once("archive.php");
- $test = new zip_file("app.zip");
- $ test->set_options(
- array(
-
'basedir' => dirname($modpath),
-
'inmemory' => 0, //Does not compress the memory.
but stores it directly in Disk. If you want to compress the download, you can choose 1
-
'recurse' => 1, // Whether to compress subdirectories,
resurse, what does recursion mean?
-
'storepaths' = > 1, //Whether to store the directory structure, I choose yes.
-
'overwrite' => 1, //Whether to cover
-
'prepend' = > "", //Unknown
-
'followlinks' => 0, //Unknown
-
'method' => 1, //Unknown
-
'sfx' => "", //Don’t know what it means
- )
- );
-
$test->add_files("src/archive.php");
-
$test->add_files("/App");
-
$test->create_archive();
- $test->download_file();
//If you don’t write this line, the data will only be stored in memory Inside
- //The following code is to decompress
-
$test = new tar_file("archives/test.tar");
-
$test- >set_options(array('inmemory' => 0));
-
$test->extract_files();
-
?> >We hope that this code example introduced in this article can help us further understand the meaning of PHP compressed folders.
http://www.bkjia.com/PHPjc/446142.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446142.htmlTechArticleHowever, there is no function for folder operations in the zlib library (of course, we can also write one ourselves, but this is too trouble), we can go online and download some ready-made books written by our ancestors...