W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0)
PharFileInfo::getMetadata — 返回與文件一起保存的特定于文件的元數(shù)據(jù)
public PharFileInfo::getMetadata(array $unserializeOptions = []): mixed
返回此文件的 Phar 存檔清單中保存的元數(shù)據(jù)。
任何可以序列化并存儲(chǔ)為文件元數(shù)據(jù)的 PHP 變量, 如果未存儲(chǔ)元數(shù)據(jù),則為 null。
版本 | 說(shuō)明 |
---|---|
8.0.0 | 已添加該參數(shù)。unserializeOptions |
示例 #1 A PharFileInfo::getMetadata() example
<?php
// make sure it doesn't exist
@unlink('brandnewphar.phar');
try {
$p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar');
$p['file.txt'] = 'hello';
$p['file.txt']->setMetadata(array('user' => 'bill', 'mime-type' => 'text/plain'));
var_dump($p['file.txt']->getMetadata());
} catch (Exception $e) {
echo 'Could not create/modify brandnewphar.phar: ', $e;
}
?>
以上示例會(huì)輸出:
array(2) { ["user"]=> string(4) "bill" ["mime-type"]=> string(10) "text/plain" }
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)系方式:
更多建議: