本文整理汇总了PHP中Phar::webPhar方法的典型用法代码示例。如果您正苦于以下问题:PHP Phar::webPhar方法的具体用法?PHP Phar::webPhar怎么用?PHP Phar::webPhar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phar
的用法示例。
在下文中一共展示了Phar::webPhar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
Phar::mungServer(array("PHP_SELF", "SCRIPT_NAME", "SCRIPT_FILENAME", "REQUEST_URI"));
Phar::webPhar();
echo "oops did not run\n";
var_dump($_ENV, $_SERVER);
__halt_compiler(); ?>
7 index.php;¯ÆkJ;WËR¶<?php
var_dump($_SERVER["PHP_SELF"]);
var_dump($_SERVER[b"SCRIPT_NAME"]);
var_dump($_SERVER[b"SCRIPT_FILENAME"]);
var_dump($_SERVER[b"REQUEST_URI"]);
var_dump($_SERVER[b"PHAR_PHP_SELF"]);
var_dump($_SERVER[b"PHAR_SCRIPT_NAME"]);
var_dump($_SERVER[b"PHAR_SCRIPT_FILENAME"]);
var_dump($_SERVER[b"PHAR_REQUEST_URI"]);
cìäj�Fgsð_qúšGBMB
示例2: set_include_path
<?php
$web = 'web.php';
if (in_array('phar', stream_get_wrappers()) && class_exists('Phar', 0)) {
Phar::interceptFileFuncs();
set_include_path('phar://' . __FILE__ . PATH_SEPARATOR . get_include_path());
Phar::webPhar(null, $web);
include 'phar://' . __FILE__ . '/' . Extract_Phar::START;
return;
}
if (@(isset($_SERVER['REQUEST_URI']) && isset($_SERVER['REQUEST_METHOD']) && ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'POST'))) {
Extract_Phar::go(true);
$mimes = array('phps' => 2, 'c' => 'text/plain', 'cc' => 'text/plain', 'cpp' => 'text/plain', 'c++' => 'text/plain', 'dtd' => 'text/plain', 'h' => 'text/plain', 'log' => 'text/plain', 'rng' => 'text/plain', 'txt' => 'text/plain', 'xsd' => 'text/plain', 'php' => 1, 'inc' => 1, 'avi' => 'video/avi', 'bmp' => 'image/bmp', 'css' => 'text/css', 'gif' => 'image/gif', 'htm' => 'text/html', 'html' => 'text/html', 'htmls' => 'text/html', 'ico' => 'image/x-ico', 'jpe' => 'image/jpeg', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'js' => 'application/x-javascript', 'midi' => 'audio/midi', 'mid' => 'audio/midi', 'mod' => 'audio/mod', 'mov' => 'movie/quicktime', 'mp3' => 'audio/mp3', 'mpg' => 'video/mpeg', 'mpeg' => 'video/mpeg', 'pdf' => 'application/pdf', 'png' => 'image/png', 'swf' => 'application/shockwave-flash', 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'wav' => 'audio/wav', 'xbm' => 'image/xbm', 'xml' => 'text/xml');
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
$basename = basename(__FILE__);
if (!strpos($_SERVER['REQUEST_URI'], $basename)) {
chdir(Extract_Phar::$temp);
include $web;
return;
}
$pt = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], $basename) + strlen($basename));
if (!$pt || $pt == '/') {
$pt = $web;
header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . $_SERVER['REQUEST_URI'] . '/' . $pt);
exit;
}
$a = realpath(Extract_Phar::$temp . DIRECTORY_SEPARATOR . $pt);
if (!$a || strlen(dirname($a)) < strlen(Extract_Phar::$temp)) {
header('HTTP/1.0 404 Not Found');
示例3: set_include_path
<?php
set_include_path("phar://" . __FILE__);
try {
Phar::webPhar("test.phar", "/start/index.php");
} catch (Exception $e) {
die($e->getMessage() . "\n");
}
echo "oops did not run\n";
var_dump($_ENV, $_SERVER);
__halt_compiler(); ?>
‘start/index.php9!ïH9HÙ—N¶start/another.php>!ïH>|
Øó¶another.php!ïHb½‹š¶<?php
echo "start/index.php\n";
include "./another.php";
<?php
echo "start/another.php\n";
include "../another.php";
?><?php
echo "another.php\n";
?>{œ¬a–1ÚK©™TIf¹çTÊ*GBMB
示例4: substr
$cpath = substr($path, 1);
$bFoundMatch = false;
$map = (include 'phar://' . __FILE__ . '/src/gen-rewritemap.php');
foreach ($map as $pattern => $replace) {
if (preg_match($pattern, $cpath, $matches)) {
$bFoundMatch = true;
break;
}
}
if (!$bFoundMatch) {
return $path;
}
$newcpath = preg_replace($pattern, $replace, $cpath);
if (strpos($newcpath, '?') === false) {
return '/' . $newcpath;
}
list($cfile, $getParams) = explode('?', $newcpath, 2);
if ($getParams != '') {
parse_str($getParams, $_GET);
}
return '/' . $cfile;
}
//Phar::interceptFileFuncs();
set_include_path('phar://' . __FILE__ . PATH_SEPARATOR . 'phar://' . __FILE__ . '/lib/');
Phar::webPhar(null, $web, null, array(), 'rewritePath');
//TODO: implement CLI script runner
echo "phorkie can only be used in the browser\n";
exit(1);
__halt_compiler();
?>
示例5: catch
<?php
try {
Phar::webPhar('oopsiedaisy.phar', '/index.php');
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
__halt_compiler();
?>
示例6: microsite_rewrite
function microsite_rewrite()
{
$r = $_SERVER['REQUEST_URI'];
if (strpos($r, '/microsite.phar') !== false) {
$r = preg_replace('#^.*/microsite.phar#', '', $r);
}
if (file_exists("phar://microsite.phar{$r}")) {
return $r;
} else {
return 'index.php';
}
}
$index = str_replace('\\', DIRECTORY_SEPARATOR, 'index.php');
$fourohfour = str_replace('\\', DIRECTORY_SEPARATOR, '404.php');
$mimes = array('phps' => Phar::PHPS, 'c' => 'text/plain', 'cc' => 'text/plain', 'cpp' => 'text/plain', 'c++' => 'text/plain', 'dtd' => 'text/plain', 'h' => 'text/plain', 'log' => 'text/plain', 'rng' => 'text/plain', 'txt' => 'text/plain', 'xsd' => 'text/plain', 'php' => Phar::PHP, 'inc' => Phar::PHP, 'avi' => 'video/avi', 'bmp' => 'image/bmp', 'css' => 'text/css', 'gif' => 'image/gif', 'htm' => 'text/html', 'html' => 'text/html', 'htmls' => 'text/html', 'ico' => 'image/x-ico', 'jpe' => 'image/jpeg', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'js' => 'application/x-javascript', 'midi' => 'audio/midi', 'mid' => 'audio/midi', 'mod' => 'audio/mod', 'mov' => 'movie/quicktime', 'mp3' => 'audio/mp3', 'mpg' => 'video/mpeg', 'mpeg' => 'video/mpeg', 'pdf' => 'application/pdf', 'png' => 'image/png', 'swf' => 'application/shockwave-flash', 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'wav' => 'audio/wav', 'xbm' => 'image/xbm', 'xml' => 'text/xml');
Phar::webPhar("microsite.phar", 'index.php', '404.php', $mimes, 'microsite_rewrite');
}
// Make sure the autoloader is loaded
include 'phar://microsite.phar/lib/Microsite/Autoloader.php';
// Initialize the autoloader class
\Microsite\Autoloader::init();
// If we're running on the console, do other useful things
switch (php_sapi_name()) {
case 'cli':
\Microsite\Console::run();
break;
case 'cli-server':
// This is what executes when the app is run from the PHP-based server.
break;
}
__halt_compiler();
示例7: s
<?php
function s($a)
{
static $b = array("/hi" => false);
if (isset($b[$a])) {
return $b[$a];
}
return $a;
}
Phar::webPhar("whatever", "index.php", null, array(), "s");
echo "oops did not run\n";
var_dump($_ENV, $_SERVER);
__halt_compiler(); ?>
va.php?кkJГ№илХa.jpg?кkJГ№илХa.phps?кkJlЂ`Хhiohio<?php function hio(){}*ъЮ*іъ\xћѕЎМ,:~p2GBMB
示例8: array
<?php
try {
Phar::webPhar("test.phar", "/index.php", null, array(), "sort");
} catch (Exception $e) {
die($e->getMessage() . "\n");
}
echo "oops did not run\n";
var_dump($_ENV, $_SERVER);
__halt_compiler(); ?>
7 index.phpÝhHJVÔ‹¶<?php
echo "hi";
éîœoaÇÏHºª€ZÀ"[x�´GBMB
示例9: __autoload
<?php
function __autoload($class)
{
$class = str_replace("Pyrus\\Developer\\CoverageAnalyzer\\", "", $class);
var_dump($class);
include "phar://" . __FILE__ . "/" . str_replace("\\", "/", $class) . ".php";
}
Phar::webPhar("pear2coverage.phar.php");
echo "This phar is a web application, run within your web browser to use\n";
exit - 1;
__halt_compiler(); ?>
�&PEAR2d'N�PEAR2/Templatesd'N�PEAR2/Templates/Savantd'N�1PEAR2/Templates/Savant/BadMethodCallException.phpd'Np����,PEAR2/Templates/Savant/BasicFastCompiler.php�d'N��<�0PEAR2/Templates/Savant/ClassToTemplateMapper.php�d'N�J�Y��,PEAR2/Templates/Savant/CompilerException.phpnd'Nn�|ϧ�,PEAR2/Templates/Savant/CompilerInterface.phpod'No���$PEAR2/Templates/Savant/Exception.phpDd'NDJ1�0PEAR2/Templates/Savant/FastCompilerInterface.phpgd'Ng�YKS�)PEAR2/Templates/Savant/FilterAbstract.php�d'N���^�PEAR2/Templates/Savant/Main.php�hd'N�h/����*PEAR2/Templates/Savant/MapperInterface.php`d'N`@��̶"PEAR2/Templates/Savant/ObjectProxyd'N�2PEAR2/Templates/Savant/ObjectProxy/ArrayAccess.phpBd'NB�Y�Ŷ4PEAR2/Templates/Savant/ObjectProxy/ArrayIterator.php�d'N��c�ض2PEAR2/Templates/Savant/ObjectProxy/ArrayObject.php�d'N�-�1�2PEAR2/Templates/Savant/ObjectProxy/Traversable.phpQd'NQ,r�p�&PEAR2/Templates/Savant/ObjectProxy.phpd'N�sg\�,PEAR2/Templates/Savant/TemplateException.phpnd'Nn��N�3PEAR2/Templates/Savant/UnexpectedValueException.php�d'N�mJ�z�Web/Aggregator.php�d'N�u�7�Web/ClassToTemplateMapper.php�d'N�����Web/Controller.php�d'N�`�+}�Web/Exception.phpbd'NbT0:�Web/LineSummary.phpd'N�aOv�Web/SelectDatabase.php�d'N��S臨Web/Summary.php�d'N��p��Web/TestCoverage.php�d'N�Y�պ�Web/TestSummary.php�d'N�%ؠ�Web/View.phpBd'NB�oSourceFile.php�d'N���2�Aggregator.phpd'N)�;߶
Exception.php^d'N^�e\j�
Sqlite.php�d'N��w*�SourceFile/PerTest.phpd'N���� cover.css�d'N�3�ʶ index.php�d'N������<?php
namespace PEAR2\Templates\Savant;
class BadMethodCallException extends \BadMethodCallException implements Exception
{
}<?php
namespace PEAR2\Templates\Savant;
class BasicFastCompiler implements FastCompilerInterface
{
/**
* Directory where compiled templates will be stored
*
* @var string
*/
示例10: unset
xd_v141226_dev::initialize();
// Also creates class alias.
}
# -----------------------------------------------------------------------------------------------------------------------------------------
# Inline webPhar handler.
# -----------------------------------------------------------------------------------------------------------------------------------------
/*
* A XDaRk Core webPhar instance?
* This serves files straight from a PHP Archive.
*/
if (xd_v141226_dev::is_webphar()) {
unset($GLOBALS[xd_v141226_dev::autoload_var()]);
if (!xd_v141226_dev::can_phar()) {
throw new exception(xd_v141226_dev::cant_phar_msg());
}
Phar::webPhar('xd-v141226-dev', 'index.php', '', xd_v141226_dev::web_phar_mime_types(), 'xd_v141226_dev::web_phar_rewriter');
return;
// We can stop here.
}
# -----------------------------------------------------------------------------------------------------------------------------------------
# Inline autoload handler.
# -----------------------------------------------------------------------------------------------------------------------------------------
/*
* A XDaRk Core autoload instance?
* On by default (disable w/ global var as necessary).
*/
if (xd_v141226_dev::is_autoload()) {
unset($GLOBALS[xd_v141226_dev::autoload_var()]);
if (!defined('WPINC') && !xd_v141226_dev::wp_load()) {
throw new exception(xd_v141226_dev::no_wp_msg());
}
示例11: array
<?php
Phar::mungServer(array());
Phar::webPhar("whatever", "index.php", null, array("jpg" => "foo/bar", "phps" => Phar::PHP, "php" => Phar::PHPS));
echo "oops did not run\n";
var_dump($_ENV, $_SERVER);
__halt_compiler(); ?>
�a.phps��H
�k+�a.jpg��H��b��a.php��Hl�`�fronk.gronk��H!�eŶhio1hio2<?php function hio(){}hio3:�\鿯��/�F�<����GBMB
示例12: array
<?php
Phar::webPhar("whatever", "index.php", null, array(0 => "oops"));
echo "oops did not run\n";
var_dump($_ENV, $_SERVER);
__halt_compiler(); ?>
va.phpЄbДHня╖╨╢a.jpgЄbДHня╖╨╢a.phpsЄbДHlБ`╢hiohio<?php function hio(){}vcпnJщЎил ╤X├@0Е2ЙGBMB
示例13: dirname
<?php
Phar::interceptFileFuncs();
if (file_exists(dirname(__FILE__) . "/files/config.xml")) {
Phar::mount("config.xml", dirname(__FILE__) . "/files/config.xml");
}
Phar::webPhar("blog", "index.php");
__halt_compiler(); ?>
^ index.php�?2�I�坙��install.php?2�I2���<?php if (!file_exists("config.xml")) {
include "install.php";
exit;
}
var_dump(str_replace("\r\n", "\n", file_get_contents("config.xml")));
?><?php echo "install\n"; ?>0�])IgF|������a��GBMB
示例14: array
<?php
Phar::webPhar("whatever", "index.php", null, array("php" => 100));
echo "oops did not run\n";
var_dump($_ENV, $_SERVER);
__halt_compiler(); ?>
va.phpўbДHня╖╨╢a.jpgўbДHня╖╨╢a.phpsўbДHlБ`╢hiohio<?php function hio(){}j#B2'╠Е`lLЙD╜фЪ7с╘GBMB
示例15: array
<?php
try {
Phar::webPhar("test.phar", "/index.php", null, array(), array("fail", "here"));
} catch (Exception $e) {
die($e->getMessage() . "\n");
}
echo "oops did not run\n";
var_dump($_ENV, $_SERVER);
__halt_compiler(); ?>
7 index.phpÛhHJVÔ‹¶<?php
echo "hi";
³PÜÉ×f*ß|ûúÝ•P-7ªV´JGBMB