2024 日本 PHP 研討會

PharData 類別

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

簡介

PharData 類別提供了一個高階介面,用於存取和建立不可執行的 tar 和 zip 封存檔。由於這些封存檔不包含 stub 且無法由 phar 擴充功能執行,因此即使 php.ini 設定中的 phar.readonly1,也可以使用 PharData 類別建立和操作普通的 zip 和 tar 檔案。

類別概要

類別 PharData 繼承自 RecursiveDirectoryIterator 實作 CountableArrayAccess {
/* 繼承的常數 */
/* 方法 */
公開 __construct(
    字串 $filename,
    整數 $flags = FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS,
    ?字串 $alias = null,
    整數 $format = 0
)
公開 新增空目錄(字串 $directory):
公開 新增檔案(字串 $filename, ?字串 $localName = 空值):
公開 從字串新增(字串 $localName, 字串 $contents):
公開 從目錄建置(字串 $directory, 字串 $pattern = ""): 陣列
公開 從迭代器建置(可遍歷 $iterator, ?字串 $baseDirectory = 空值): 陣列
公開 壓縮(整數 $compression, ?字串 $extension = 空值): ?PharData
公開 壓縮檔案(整數 $compression):
公開 convertToData(?int $format = null, ?int $compression = null, ?string $extension = null): ?PharData
公開 convertToExecutable(?int $format = null, ?int $compression = null, ?string $extension = null): ?Phar
公開 複製(字串 $from, 字串 $to): true
公開 解壓縮(?字串 $extension = null): ?PharData
公開 刪除(字串 $localName): true
公開 extractTo(字串 $directory, 陣列|字串|空值 $files = null, 布林值 $overwrite = false): 布林值
公開 offsetSet(字串 $localName, 資源|字串 $value):
公開 offsetUnset(字串 $localName):
公開 setAlias(字串 $alias): 布林值
公開 setDefaultStub(?字串 $index = null, ?字串 $webIndex = null): 布林值
公開 setMetadata(混合 $metadata):
公開 setSignatureAlgorithm(整數 $algo, ?字串 $privateKey = null):
公開 setStub(字串 $stub, 整數 $len = -1): 布林
公開 __destruct()
/* 繼承的方法 */
公開 SplFileInfo::getBasename(字串 $suffix = ""): 字串
公開 SplFileInfo::openFile(字串 $mode = "r", 布林值 $useIncludePath = false, ?資源 $context = null): SplFileObject
公開 SplFileInfo::setFileClass(字串 $class = SplFileObject::class):
公開 SplFileInfo::setInfoClass(字串 $class = SplFileInfo::class):
}

目錄

新增註釋

使用者貢獻的註釋

此頁面沒有使用者貢獻的註釋。
To Top