首页
学习
活动
专区
圈层
工具
发布

PharData (class)

Introduction

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

The PharData class provides a high-level interface to accessing and creating non-executable tar and zip archives. Because these archives do not contain a stub and cannot be executed by the phar extension, it is possible to create and manipulate regular zip and tar files using the PharData class even if phar.readonly php.ini setting is 1.

Class synopsis

PharData extends Phar {

/* Methods */

代码语言:javascript
代码运行次数:0
复制
bool addEmptyDir ( string $dirname )
代码语言:javascript
代码运行次数:0
复制
public void Phar::addFile ( string $file [, string $localname ] )
代码语言:javascript
代码运行次数:0
复制
bool addFromString ( string $localname , string $contents )
代码语言:javascript
代码运行次数:0
复制
public array Phar::buildFromDirectory ( string $base_dir [, string $regex ] )
代码语言:javascript
代码运行次数:0
复制
array buildFromIterator ( Iterator $iter [, string $base_directory ] )
代码语言:javascript
代码运行次数:0
复制
object compress ( int $compression [, string $extension ] )
代码语言:javascript
代码运行次数:0
复制
bool compressFiles ( int $compression )
代码语言:javascript
代码运行次数:0
复制
__construct ( string $fname [, int $flags [, string $alias [, int $format = Phar::TAR ]]] )
代码语言:javascript
代码运行次数:0
复制
PharData convertToData ([ int $format [, int $compression [, string $extension ]]] )
代码语言:javascript
代码运行次数:0
复制
Phar convertToExecutable ([ int $format [, int $compression [, string $extension ]]] )
代码语言:javascript
代码运行次数:0
复制
bool copy ( string $oldfile , string $newfile )
代码语言:javascript
代码运行次数:0
复制
object decompress ([ string $extension ] )
代码语言:javascript
代码运行次数:0
复制
bool decompressFiles ( void )
代码语言:javascript
代码运行次数:0
复制
bool delMetadata ( void )
代码语言:javascript
代码运行次数:0
复制
bool delete ( string $entry )
代码语言:javascript
代码运行次数:0
复制
bool extractTo ( string $pathto [, string|array $files [, bool $overwrite = false ]] )
代码语言:javascript
代码运行次数:0
复制
bool isWritable ( void )
代码语言:javascript
代码运行次数:0
复制
void offsetSet ( string $offset , string $value )
代码语言:javascript
代码运行次数:0
复制
bool offsetUnset ( string $offset )
代码语言:javascript
代码运行次数:0
复制
bool setAlias ( string $alias )
代码语言:javascript
代码运行次数:0
复制
bool setDefaultStub ([ string $index [, string $webindex ]] )
代码语言:javascript
代码运行次数:0
复制
public void Phar::setMetadata ( mixed $metadata )
代码语言:javascript
代码运行次数:0
复制
public void Phar::setSignatureAlgorithm ( int $sigtype )
代码语言:javascript
代码运行次数:0
复制
bool setStub ( string $stub [, int $len = -1 ] )

/* Inherited methods */

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

}

Table of Contents

  • PharData::addEmptyDir — Add an empty directory to the tar/zip archive
  • PharData::addFile — Add a file from the filesystem to the tar/zip archive
  • PharData::addFromString — Add a file from the filesystem to the tar/zip archive
  • PharData::buildFromDirectory — Construct a tar/zip archive from the files within a directory.
  • PharData::buildFromIterator — Construct a tar or zip archive from an iterator.
  • PharData::compress — Compresses the entire tar/zip archive using Gzip or Bzip2 compression
  • PharData::compressFiles — Compresses all files in the current tar/zip archive
  • PharData::__construct — Construct a non-executable tar or zip archive object
  • PharData::convertToData — Convert a phar archive to a non-executable tar or zip file
  • PharData::convertToExecutable — Convert a non-executable tar/zip archive to an executable phar archive
  • PharData::copy — Copy a file internal to the phar archive to another new file within the phar
  • PharData::decompress — Decompresses the entire Phar archive
  • PharData::decompressFiles — Decompresses all files in the current zip archive
  • PharData::delMetadata — Deletes the global metadata of a zip archive
  • PharData::delete — Delete a file within a tar/zip archive
  • PharData::extractTo — Extract the contents of a tar/zip archive to a directory
  • PharData::isWritable — Returns true if the tar/zip archive can be modified
  • PharData::offsetSet — set the contents of a file within the tar/zip to those of an external file or string
  • PharData::offsetUnset — remove a file from a tar/zip archive
  • PharData::setAlias — dummy function (Phar::setAlias is not valid for PharData)
  • PharData::setDefaultStub — dummy function (Phar::setDefaultStub is not valid for PharData)
  • Phar::setMetadata — Sets phar archive meta-data
  • Phar::setSignatureAlgorithm — set the signature algorithm for a phar and apply it.
  • PharData::setStub — dummy function (Phar::setStub is not valid for PharData)

← Phar::webPhar

PharData::addEmptyDir →

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

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

扫码关注腾讯云开发者

领取腾讯云代金券