首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

Phar (class)

Introduction

(PHP >= 5.3.0, PECL phar >= 1.0.0)

The Phar class provides a high-level interface to accessing and creating phar archives.

Class synopsis

Phar extends RecursiveDirectoryIterator implements Countable , ArrayAccess {

/* Methods */

代码语言:javascript
复制
public void addEmptyDir ( string $dirname )
代码语言:javascript
复制
public void addFile ( string $file [, string $localname ] )
代码语言:javascript
复制
public void addFromString ( string $localname , string $contents )
代码语言:javascript
复制
final public static string apiVersion ( void )
代码语言:javascript
复制
public array buildFromDirectory ( string $base_dir [, string $regex ] )
代码语言:javascript
复制
public array buildFromIterator ( Iterator $iter [, string $base_directory ] )
代码语言:javascript
复制
final public static bool canCompress ([ int $type = 0 ] )
代码语言:javascript
复制
final public static bool canWrite ( void )
代码语言:javascript
复制
public object compress ( int $compression [, string $extension ] )
代码语言:javascript
复制
public bool compressAllFilesBZIP2 ( void )
代码语言:javascript
复制
public bool compressAllFilesGZ ( void )
代码语言:javascript
复制
public void compressFiles ( int $compression )
代码语言:javascript
复制
public __construct ( string $fname [, int $flags [, string $alias ]] )
代码语言:javascript
复制
public PharData convertToData ([ int $format = 9021976 [, int $compression = 9021976 [, string $extension ]]] )
代码语言:javascript
复制
public Phar convertToExecutable ([ int $format = 9021976 [, int $compression = 9021976 [, string $extension ]]] )
代码语言:javascript
复制
public bool copy ( string $oldfile , string $newfile )
代码语言:javascript
复制
public int count ( void )
代码语言:javascript
复制
final public static string createDefaultStub ([ string $indexfile [, string $webindexfile ]] )
代码语言:javascript
复制
public object decompress ([ string $extension ] )
代码语言:javascript
复制
public bool decompressFiles ( void )
代码语言:javascript
复制
public bool delMetadata ( void )
代码语言:javascript
复制
public bool delete ( string $entry )
代码语言:javascript
复制
public bool extractTo ( string $pathto [, string|array $files [, bool $overwrite = false ]] )
代码语言:javascript
复制
public mixed getMetadata ( void )
代码语言:javascript
复制
public bool getModified ( void )
代码语言:javascript
复制
public array getSignature ( void )
代码语言:javascript
复制
public string getStub ( void )
代码语言:javascript
复制
final public static array getSupportedCompression ( void )
代码语言:javascript
复制
final public static array getSupportedSignatures ( void )
代码语言:javascript
复制
public string getVersion ( void )
代码语言:javascript
复制
public bool hasMetadata ( void )
代码语言:javascript
复制
final public static void interceptFileFuncs ( void )
代码语言:javascript
复制
public bool isBuffering ( void )
代码语言:javascript
复制
public mixed isCompressed ( void )
代码语言:javascript
复制
public bool isFileFormat ( int $format )
代码语言:javascript
复制
final public static bool isValidPharFilename ( string $filename [, bool $executable = true ] )
代码语言:javascript
复制
public bool isWritable ( void )
代码语言:javascript
复制
final public static bool loadPhar ( string $filename [, string $alias ] )
代码语言:javascript
复制
final public static bool mapPhar ([ string $alias [, int $dataoffset = 0 ]] )
代码语言:javascript
复制
final public static void mount ( string $pharpath , string $externalpath )
代码语言:javascript
复制
final public static void mungServer ( array $munglist )
代码语言:javascript
复制
public bool offsetExists ( string $offset )
代码语言:javascript
复制
public int offsetGet ( string $offset )
代码语言:javascript
复制
public void offsetSet ( string $offset , string $value )
代码语言:javascript
复制
public bool offsetUnset ( string $offset )
代码语言:javascript
复制
final public static string running ([ bool $retphar = true ] )
代码语言:javascript
复制
public bool setAlias ( string $alias )
代码语言:javascript
复制
public bool setDefaultStub ([ string $index [, string $webindex ]] )
代码语言:javascript
复制
public void setMetadata ( mixed $metadata )
代码语言:javascript
复制
public void setSignatureAlgorithm ( int $sigtype [, string $privatekey ] )
代码语言:javascript
复制
public bool setStub ( string $stub [, int $len = -1 ] )
代码语言:javascript
复制
public void startBuffering ( void )
代码语言:javascript
复制
public void stopBuffering ( void )
代码语言:javascript
复制
public bool uncompressAllFiles ( void )
代码语言:javascript
复制
final public static bool unlinkArchive ( string $archive )
代码语言:javascript
复制
final public static void webPhar ([ string $alias [, string $index = "index.php" [, string $f404 [, array $mimetypes [, callable $rewrites ]]]]] )

}

Table of Contents

  • Phar::addEmptyDir — Add an empty directory to the phar archive
  • Phar::addFile — Add a file from the filesystem to the phar archive
  • Phar::addFromString — Add a file from a string to the phar archive
  • Phar::apiVersion — Returns the api version
  • Phar::buildFromDirectory — Construct a phar archive from the files within a directory.
  • Phar::buildFromIterator — Construct a phar archive from an iterator.
  • Phar::canCompress — Returns whether phar extension supports compression using either zlib or bzip2
  • Phar::canWrite — Returns whether phar extension supports writing and creating phars
  • Phar::compress — Compresses the entire Phar archive using Gzip or Bzip2 compression
  • Phar::compressAllFilesBZIP2 — Compresses all files in the current Phar archive using Bzip2 compression
  • Phar::compressAllFilesGZ — Compresses all files in the current Phar archive using Gzip compression
  • Phar::compressFiles — Compresses all files in the current Phar archive
  • Phar::__construct — Construct a Phar archive object
  • Phar::convertToData — Convert a phar archive to a non-executable tar or zip file
  • Phar::convertToExecutable — Convert a phar archive to another executable phar archive file format
  • Phar::copy — Copy a file internal to the phar archive to another new file within the phar
  • Phar::count — Returns the number of entries (files) in the Phar archive
  • Phar::createDefaultStub — Create a phar-file format specific stub
  • Phar::decompress — Decompresses the entire Phar archive
  • Phar::decompressFiles — Decompresses all files in the current Phar archive
  • Phar::delMetadata — Deletes the global metadata of the phar
  • Phar::delete — Delete a file within a phar archive
  • Phar::extractTo — Extract the contents of a phar archive to a directory
  • Phar::getMetadata — Returns phar archive meta-data
  • Phar::getModified — Return whether phar was modified
  • Phar::getSignature — Return MD5/SHA1/SHA256/SHA512/OpenSSL signature of a Phar archive
  • Phar::getStub — Return the PHP loader or bootstrap stub of a Phar archive
  • Phar::getSupportedCompression — Return array of supported compression algorithms
  • Phar::getSupportedSignatures — Return array of supported signature types
  • Phar::getVersion — Return version info of Phar archive
  • Phar::hasMetadata — Returns whether phar has global meta-data
  • Phar::interceptFileFuncs — instructs phar to intercept fopen, file_get_contents, opendir, and all of the stat-related functions
  • Phar::isBuffering — Used to determine whether Phar write operations are being buffered, or are flushing directly to disk
  • Phar::isCompressed — Returns Phar::GZ or PHAR::BZ2 if the entire phar archive is compressed (.tar.gz/tar.bz and so on)
  • Phar::isFileFormat — Returns true if the phar archive is based on the tar/phar/zip file format depending on the parameter
  • Phar::isValidPharFilename — Returns whether the given filename is a valid phar filename
  • Phar::isWritable — Returns true if the phar archive can be modified
  • Phar::loadPhar — Loads any phar archive with an alias
  • Phar::mapPhar — Reads the currently executed file (a phar) and registers its manifest
  • Phar::mount — Mount an external path or file to a virtual location within the phar archive
  • Phar::mungServer — Defines a list of up to 4 $_SERVER variables that should be modified for execution
  • Phar::offsetExists — determines whether a file exists in the phar
  • Phar::offsetGet — Gets a PharFileInfo object for a specific file
  • Phar::offsetSet — set the contents of an internal file to those of an external file
  • Phar::offsetUnset — remove a file from a phar
  • Phar::running — Returns the full path on disk or full phar URL to the currently executing Phar archive
  • Phar::setAlias — Set the alias for the Phar archive
  • Phar::setDefaultStub — Used to set the PHP loader or bootstrap stub of a Phar archive to the default loader
  • Phar::setMetadata — Sets phar archive meta-data
  • Phar::setSignatureAlgorithm — set the signature algorithm for a phar and apply it.
  • Phar::setStub — Used to set the PHP loader or bootstrap stub of a Phar archive
  • Phar::startBuffering — Start buffering Phar write operations, do not modify the Phar object on disk
  • Phar::stopBuffering — Stop buffering write requests to the Phar archive, and save changes to disk
  • Phar::uncompressAllFiles — Uncompresses all files in the current Phar archive
  • Phar::unlinkArchive — Completely remove a phar archive from disk and from memory
  • Phar::webPhar — mapPhar for web-based phars. front controller for web applications

Phar::addEmptyDir →

代码语言:txt
复制
 © 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

扫码关注腾讯云开发者

领取腾讯云代金券