However, there are no functions for folder operations in the Zlib library (of course, we can write one ourselves, but it is too cumbersome), we can go online to download some of the ready-made, written by our predecessors, expanded the Zlib function library tools.
PHP compressed folder specific implementation code:
- < ? PHP
- Require_once ("archive.php");
- $ Test = New zip_file ("App.zip");
- $test- > Set_options (
- Array
- ' basedir ' = > dirname ($modpath),
- ' inmemory ' = > 0,//not in memory compression.
Instead, it is stored directly on the disk. If you want to compress the download, you can choose to 1
- ' recurse ' = > 1,//whether to compress sub-directories,
Resurse, the meaning of recursion?
- ' storepaths ' = > 1,//Whether the directory structure is stored, I choose Yes.
- ' Overwrite ' = > 1,//whether to overwrite
- ' 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 ();
Do not write this line, the data only exists in memory
- The following code is the decompression
- $ Test = New tar_file ("Archives/test.tar");
- $test- > set_options (Array (' inmemory ' => 0));
- $test- > extract_files ();
- ?>
I hope that this code example described in this article can help us to further understand the meaning of the PHP compressed folder.
http://www.bkjia.com/PHPjc/446142.html www.bkjia.com true http://www.bkjia.com/PHPjc/446142.html techarticle However, there are no functions for folder operation in the Zlib library (of course, we can write one ourselves, but this is too much trouble), we can go online to download some off-the-shelf, written by our predecessors ...