Phar::createDefaultStub
(Unknown)
Phar::createDefaultStub — Return the PHP loader or bootstrap stub of a Phar archive
Описание
string Phar::createDefaultStub
([ string $indexfile
[, string $webindexfile
]] )
Phar archives contain a bootstrap loader, or stub
written in PHP that is executed when the archive is executed in PHP either via
include:
<?php
include 'myphar.phar';
?>
or by simple execution:
This method provides a simple and easy method to create a stub that will
run a startup file from the phar archive. In addition, different files can
be specified for running the phar archive from the command line versus through
a web server. The loader stub also calls Phar::interceptFileFuncs()
to allow easy bundling of a PHP application that accesses the file system. If the
phar extension is not present, the loader stub will extract the phar archive
to a temporary directory and then operate on the files. A shutdown function
erases the temporary files on exit.
Возвращаемые значения
Returns a string containing the contents of a customized bootstrap loader (stub)
that allows the created Phar archive to work with or without the Phar extension
enabled.
Примеры
Пример #1 A Phar::createDefaultStub() example
try {
$phar = new Phar('myphar.phar');
$phar->setStub($phar->createDefaultStub('cli.php', 'web/index.php'));
} catch (Exception $e) {
// handle errors
}
Смотрите также
- Phar::setStub() - Used to set the PHP loader or bootstrap stub of a Phar archive
- Phar::getStub() - Return the PHP loader or bootstrap stub of a Phar archive