|
Phar::webPharmapPhar for web-based phars. front controller for web applications Description
final public static void Phar::webPhar
([ string
$alias
[, string $index = "index.php"
[, string $f404
[, array $mimetypes
[, callable $rewrites
]]]]] )Phar::mapPhar for web-based phars. This method parses $_SERVER['REQUEST_URI'] and routes a request from a web browser to an internal file within the phar archive. In essence, it simulates a web server, routing requests to the correct file, echoing the correct headers and parsing PHP files as needed. This powerful method is part of what makes it easy to convert an existing PHP application into a phar archive. Combined with Phar::mungServer and Phar::interceptFileFuncs, any web application can be used unmodified from a phar archive. Phar::webPhar should only be called from the stub of a phar archive (see here for more information on what a stub is). Parameters
Return ValuesNo value is returned. Errors/Exceptions
Throws PharException when unable to open the internal
file to output, or if
called from a non-stub. If an invalid array value is passed into
Examples
Example #1 A Phar::webPhar example With the example below, the created phar will display Hello World if one browses to /myphar.phar/index.php or to /myphar.phar, and will display the source of index.phps if one browses to /myphar.phar/index.phps.
<?php See Also
|