PHP Phar context options

WBOY
Release: 2023-08-19 20:38:02
forward
932 people have browsed it

PHP Phar 上下文选项

Introduction

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:

compress

PHP has the following predefined constants to define the compression format

##Phar::NONE 0x00000000 No compression Phar::COMPRESSED 0x0000F000 Bit mask and file flags , used to determine if there is any compression Phar::GZ 0x00001000 zlib (gzip) compression Phar::BZ2 0x00002000 bzip2 compression
Constant Value Description

metadata

Any phar archive containing description PHP variables with information are available as arguments to the

Phar::setMetadata()method

Example

This example sets the Phar context options used to create Phar files

 array('compress' => Phar::GZ)), array('metadata' => array('user' => 'cellog'))); file_put_contents('phar://my.phar/somefile.php', 0, $context); ?>
Copy after login

The above is the detailed content of PHP Phar context options. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!