Pharstands for PHP Archive. All resources for a PHP application or library are packaged in a single.pharfile for distribution. phar files are available as IO streams with thephar://wrapper. The context options for the phar:// wrapper are as follows:
PHP has the following predefined constants to define the compression format
Constant | Value | Description | |
---|---|---|---|
0x00000000 | No compression | ||
0x0000F000 | Bit mask and file flags , used to determine if there is any compression | ||
0x00001000 | zlib (gzip) compression | ||
0x00002000 | bzip2 compression |
Phar::setMetadata()method
Example This example sets the Phar context options used to create Phar filesarray('compress' => Phar::GZ)), array('metadata' => array('user' => 'cellog'))); file_put_contents('phar://my.phar/somefile.php', 0, $context); ?>
The above is the detailed content of PHP Phar context options. For more information, please follow other related articles on the PHP Chinese website!