W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
(沒有可用的版本信息,可能僅在 Git 中)
PharData::setMetadata — 設(shè)置 phar 存檔元數(shù)據(jù)
public PharData::setMetadata(mixed $metadata): void
注意:此方法需要 將 中的 設(shè)為 以適合 Phar 對(duì)象. 否則, 將拋出PharException.php.iniphar.readonly0
Phar::setMetadata() 應(yīng)該用于存儲(chǔ)自定義數(shù)據(jù) 這描述了 Phar 檔案作為一個(gè)完整實(shí)體的一些內(nèi)容。PharFileInfo::setMetadata() 應(yīng)用于特定于文件的元數(shù)據(jù)。 如果數(shù)據(jù)很大,元數(shù)據(jù)可能會(huì)降低加載 phar 存檔的性能。
元數(shù)據(jù)的一些可能用途包括指定存檔中的哪個(gè)文件 應(yīng)用于引導(dǎo)存檔或文件清單的位置 喜歡 ? PEAR的package.xml文件。 但是,可以存儲(chǔ)描述 phar 存檔的任何有用數(shù)據(jù)。
metadata
任何包含要存儲(chǔ)的信息的 PHP 變量,用于描述 phar 存檔
沒有返回值。
示例 #1 A Phar::setMetadata() example
<?php
// make sure it doesn't exist
@unlink('brandnewphar.phar');
try {
$p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar');
$p['file.php'] = '<?php echo "hello"';
$p->setMetadata(array('bootstrap' => 'file.php'));
var_dump($p->getMetadata());
} catch (Exception $e) {
echo 'Could not create and/or modify phar:', $e;
}
?>
以上示例會(huì)輸出:
array(1) { ["bootstrap"]=> string(8) "file.php" }
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: