PharData 类

(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)

简介

PharData 类提供了一个高级接口来访问和创建不可执行的 tar 和 zip 存档。因为这些存档不包含存根,也不能被 phar 扩展执行,所以即使 phar.readonly php.ini 设置为 1,也可以使用 PharData 类创建和操作常规 zip 和 tar 文件。

类概要

class PharData extends RecursiveDirectoryIterator implements Countable, ArrayAccess {
/* 继承的常量 */
/* 方法 */
public __construct(
    string $filename,
    int $flags = FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS,
    ?string $alias = null,
    int $format = 0
)
public addEmptyDir(string $directory): void
public addFile(string $filename, ?string $localName = null): void
public addFromString(string $localName, string $contents): void
public buildFromDirectory(string $directory, string $pattern = ""): array
public buildFromIterator(Traversable $iterator, ?string $baseDirectory = null): array
public compress(int $compression, ?string $extension = null): ?PharData
public compressFiles(int $compression): void
public convertToData(?int $format = null, ?int $compression = null, ?string $extension = null): ?PharData
public convertToExecutable(?int $format = null, ?int $compression = null, ?string $extension = null): ?Phar
public copy(string $from, string $to): bool
public decompress(?string $extension = null): ?PharData
public delMetadata(): bool
public delete(string $localName): bool
public extractTo(string $directory, array|string|null $files = null, bool $overwrite = false): bool
public isWritable(): bool
public offsetSet(string $localName, resource|string $value): void
public offsetUnset(string $localName): void
public setAlias(string $alias): bool
public setDefaultStub(?string $index = null, ?string $webIndex = null): bool
public setMetadata(mixed $metadata): void
public setSignatureAlgorithm(int $algo, ?string $privateKey = null): void
public setStub(string $stub, int $len = -1): bool
public __destruct()
/* Inherited methods */
public SplFileInfo::getBasename(string $suffix = ""): string
public SplFileInfo::openFile(string $mode = "r", bool $useIncludePath = false, ?resource $context = null): SplFileObject
public SplFileInfo::setFileClass(string $class = SplFileObject::class): void
public SplFileInfo::setInfoClass(string $class = SplFileInfo::class): void
}

目录

添加笔记

用户贡献的注释

此页面没有用户贡献的注释。
To Top