Summary of PHP compression and archive extensions
To open the PHP user manual, we can see the following library of functions for processing compressed files,
Bzip2,lzf,phar,rar,zip,zlib
So what are the actual application scenarios for each of these, and we'll pick one up next.
BZIP2:
The official introduction is this:
The BZIP2 function is used to transparently read and write bzip2 (. bz2) Compressed files.
Self-Understanding as follows:
This library is a file that is processed with a. bz2 extension, which is a compact format that is commonly used under Linux, but can also be used under Windows. The specific operation is to compress files, unzip, open, write, read, close and so on. For specific use of the function, write your own test case.
LZF:
The official introduction is this:
LZF is a very fast compression algorithm, ideal for saving space with only slight speed cost. It can be optimized-speed or space at the time of compilation.
Self-Understanding as follows:
LZF is a very fast compression algorithm. It can take very little time to achieve an ideal space saving effect. It can be used to optimize speed or space at compile time.
You can use the compression function in this function library, will be compressed by a string, return the compressed string, you can also use this algorithm to compress the string in which the decompression function decompression.
Phar:
It is understood here that, with this extension, multiple PHP files can be packaged into a PHP archive (. Phar) document. And you can directly use the individual files inside. You can also convert between three file formats in a tar zip Phar.
Rar:
This extension gives only a way to read the RAR file. Cannot write.
Zip:
This extension allows you to read and write the zip archive transparently and the files inside them.
Zlib:
This module allows you to transparently read and write gzip (. GZ) Compressed Files
The above describes the PHP compression and archive extension summary, including PHP, the content of the extension, I hope that the PHP tutorial interested in a friend helpful.