Phar::loadPhar
(PHP >= 5.3.0, PECL phar >= 1.0.0)
Phar::loadPhar — Loads any phar archive with an alias
Описание
bool Phar::loadPhar
( string $filename
[, string $alias
] )
Список параметров
-
filename
-
the full or relative path to the phar archive to open
-
alias
-
The alias that may be used to refer to the phar archive. Note
that many phar archives specify an explicit alias inside the
phar archive, and a PharException will be thrown if
a new alias is specified in this case.
Возвращаемые значения
Возвращает TRUE в случае успешного завершения или FALSE в случае возникновения ошибки.
Errors/Exceptions
PharException is thrown if an alias is passed in and the phar archive
already has an explicit alias
Примеры
Пример #1 A Phar::loadPhar() example
Phar::loadPhar can be used anywhere to load an external Phar archive, whereas
Phar::mapPhar should be used in a loader stub for a Phar.
<?php
try {
Phar::loadPhar('/path/to/phar.phar', 'my.phar');
echo file_get_contents('phar://my.phar/file.txt');
} catch (PharException $e) {
echo $e;
}
?>
Смотрите также
- Phar::mapPhar() - Reads the currently executed file (a phar) and registers its manifest