PHP 7.2.0 Beta 3 Released



Phar::addEmptyDirAdd an empty directory to the phar archive


public void Phar::addEmptyDir ( string $dirname )


This method requires the php.ini setting phar.readonly to be set to 0 in order to work for Phar objects. Otherwise, a PharException will be thrown.

With this method, an empty directory is created with path dirname. This method is similar to ZipArchive::addEmptyDir().

Elenco dei parametri


The name of the empty directory to create in the phar archive

Valori restituiti

no return value, exception is thrown on failure.


Example #1 A Phar::addEmptyDir() example

try {
$a = new Phar('/path/to/phar.phar');

// demonstrates how this file is stored
$b $a['full/path/to/file']->isDir();
} catch (
Exception $e) {
// handle errors here

Vedere anche:

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top