W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
Phar::addEmptyDir — 添加一個空目錄到 phar 檔案
public Phar::addEmptyDir(string $directory): void
注意:
此方法需要 將 php.ini 中的 phar.readonly 設(shè)為 0 以適合 Phar 對象. 否則, 將拋出PharException.
通過這個方法,可以創(chuàng)建一個以 dirname 為路徑名的空目錄。 這個方法和 ZipArchive::addEmptyDir() 類似。
directory
需要在 phar 檔案中創(chuàng)建的空目錄名稱
沒有返回值, 失敗時拋出異常(exception)。
示例 #1 一個 Phar::addEmptyDir() 示例
<?php
try {
$a = new Phar('/path/to/phar.phar');
$a->addEmptyDir('/full/path/to/file');
// demonstrates how this file is stored
$b = $a['full/path/to/file']->isDir();
} catch (Exception $e) {
// handle errors here
}
?>
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: