Phar::createDefaultStub() - Phar类
Phar::createDefaultStub()
(PHP 5 >= 5.3.0, PHP 7, PECL phar >= 2.0.0)
Create a phar-file format specific stub
说明
finalpublicstaticPhar::createDefaultStub([string $indexfile[,string $webindexfile]]): stringThis method is intended for creation of phar-file format-specific stubs, and is not intended for use with tar- or zip-based phar archives.
Phar archives contain a bootstrap loader, orstubwritten in PHP that is executed when the archive is executed in PHP either via include:
or by simple execution:php myphar.phar
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.
错误/异常
Throws UnexpectedValueException if either parameter is longer than 400 bytes.
范例
A Phar::createDefaultStub() example
参见
- 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
鹏仔微信 15129739599 鹏仔QQ344225443 鹏仔前端 pjxi.com 共享博客 sharedbk.com
图片声明:本站部分配图来自网络。本站只作为美观性配图使用,无任何非法侵犯第三方意图,一切解释权归图片著作权方,本站不承担任何责任。如有恶意碰瓷者,必当奉陪到底严惩不贷!