Phar::addEmptyDir

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

Phar :: addEmptyDir - phar 아카이브에 빈 디렉토리 추가


설명

public Phar::addEmptyDir(string $directory): void

메모: 이 메서드는 Phar 객체에 대해 작동하기 위해 php.ini 설정 phar.readonly0으로 설정해야 합니다. 그렇지 않으면 PharException이 발생합니다.

이 메서드를 사용하면 경로가 dirname인 빈 디렉터리가 생성됩니다. 이 메서드는 ZipArchive::addEmptyDir()와 유사합니다.


매개변수

directory
phar 아카이브에 생성할 빈 디렉토리의 이름

반환 값

반환 값이 없으며 실패 시 예외가 발생합니다.


Examples

예제 #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
}
?>
                  
                

기타