当前位置: 首页>>代码示例>>PHP>>正文


PHP Phar::mount方法代码示例

本文整理汇总了PHP中Phar::mount方法的典型用法代码示例。如果您正苦于以下问题:PHP Phar::mount方法的具体用法?PHP Phar::mount怎么用?PHP Phar::mount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phar的用法示例。


在下文中一共展示了Phar::mount方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: catch

    echo "{$b}\n";
}
try {
    Phar::mount($pname . '/testit', 'another\\..\\mistake');
} catch (Exception $e) {
    echo $e->getMessage(), "\n";
}
try {
    Phar::mount($pname . '/notfound', dirname(__FILE__) . '/this/does/not/exist');
} catch (Exception $e) {
    echo $e->getMessage(), "\n";
}
try {
    Phar::mount($pname . '/testit', dirname(__FILE__));
} catch (Exception $e) {
    echo $e->getMessage(), "\n";
}
try {
    Phar::mount($pname . '/testit/extfile.php', dirname(__FILE__));
} catch (Exception $e) {
    echo $e->getMessage(), "\n";
}
?>
===DONE===
<?php 
error_reporting(0);
@unlink(dirname(__FILE__) . '/tempmanifest1.phar.php');
@unlink(dirname(__FILE__) . '/testit/extfile.php');
@unlink(dirname(__FILE__) . '/testit/extfile2.php');
@rmdir(dirname(__FILE__) . '/testit/directory');
@rmdir(dirname(__FILE__) . '/testit');
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:mounteddir.php

示例2: dirname

<?php

$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php\nPhar::mapPhar('hio');\n__HALT_COMPILER(); ?>";
$files = array();
$files['a/x'] = 'a';
$files['a/b/x'] = 'a';
include 'files/phar_test.inc';
include $fname;
Phar::mount("{$pname}/a/c", dirname(__FILE__));
var_dump(file_exists($pname . '/a'));
var_dump(file_exists($pname . '/a/x'));
var_dump(file_exists($pname . '/a/b'));
var_dump(file_exists($pname . '/a/b/x'));
var_dump(file_exists($pname . '/a/c'));
var_dump(file_exists($pname . '/a/c/' . basename(__FILE__)));
rename($pname . '/a', $pname . '/b');
clearstatcache();
var_dump(file_exists($pname . '/a'));
var_dump(file_exists($pname . '/a/x'));
var_dump(file_exists($pname . '/a/b'));
var_dump(file_exists($pname . '/a/b/x'));
var_dump(file_exists($pname . '/a/c'));
var_dump(file_exists($pname . '/a/c/' . basename(__FILE__)));
var_dump(file_exists($pname . '/b'));
var_dump(file_exists($pname . '/b/x'));
var_dump(file_exists($pname . '/b/b'));
var_dump(file_exists($pname . '/b/b/x'));
var_dump(file_exists($pname . '/b/c'));
var_dump(file_exists($pname . '/b/c/' . basename(__FILE__)));
开发者ID:zaky-92,项目名称:php-1,代码行数:31,代码来源:ext_phar_tests_rename_dir_and_mount.php

示例3: set_include_path

}
?>';
$a->setStub('<?php
set_include_path("phar://" . __FILE__);
include "index.php";
__HALT_COMPILER();');
Phar::mount($pname . '/testit1', __FILE__);
include $fname;
// test copying of a phar with mounted entries
$b = $a->convertToExecutable(Phar::TAR);
$b->setStub('<?php
set_include_path("phar://" . __FILE__);
include "index.php";
__HALT_COMPILER();');
try {
    include $fname2;
} catch (Exception $e) {
    echo $e->getMessage(), "\n";
}
try {
    Phar::mount($pname . '/oops', '/home/oops/../../etc/passwd:');
} catch (Exception $e) {
    echo $e->getMessage(), "\n";
}
Phar::mount($pname . '/testit2', $pname . '/testit1');
echo substr($a['testit2']->getContent(), 0, 50), "\n";
?>
===DONE===
<?php 
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php');
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar');
开发者ID:alphaxxl,项目名称:hhvm,代码行数:31,代码来源:phar_mount.php

示例4: var_dump

<?php

var_dump(file_exists('phar://' . dirname(__FILE__) . '/files/write4.phar/testit.txt'));
Phar::mount('phar://' . dirname(__FILE__) . '/files/write4.phar/testit.txt', 'phar://' . dirname(__FILE__) . '/files/write4.phar/tobemounted');
var_dump(file_exists('phar://' . dirname(__FILE__) . '/files/write4.phar/testit.txt'), file_get_contents('phar://' . dirname(__FILE__) . '/files/write4.phar/testit.txt'));
?>
===DONE===
开发者ID:lsqtongxin,项目名称:hhvm,代码行数:7,代码来源:copyonwrite4a.php

示例5: catch

    // mount config and database.sq outside phar archive
    // first arg is internal file (which must not exist)
    // second arg is external file
    Phar::mount('config/config.ini', '.config.ini');
    Phar::mount('sqlite/database.sql', '.database.sql');
} catch (Exception $e) {
    // Exception is that .config.ini and .database.sql does not exists
    // we make them
    $str = file_get_contents('tmp/.config.ini');
    file_put_contents('.config.ini', $str);
    $str = file_get_contents('tmp/.database.sql');
    file_put_contents('.database.sql', $str);
    chmod('.database.sql', 0777);
    // And mount again
    Phar::mount('config/config.ini', '.config.ini');
    Phar::mount('sqlite/database.sql', '.database.sql');
}
if (php_sapi_name() == 'cli-server') {
    $info = parse_url($_SERVER['REQUEST_URI']);
    $file = $info['path'];
    if (file_exists("./{$info['path']}") && $info['path'] != '/') {
        $full = __DIR__ . "{$file}";
        if (!file_exists($full) or is_dir($full)) {
            echo "Is dir. Or does not exists";
            return false;
        }
        $mime = file::getMime($full);
        if ($mime) {
            if ($mime == 'text/x-php') {
                return false;
            }
开发者ID:railwayc,项目名称:coscms,代码行数:31,代码来源:phar-web.php

示例6: dirname

<?php

$fname = dirname(__FILE__) . '/tempmanifest1.phar.php';
$pname = 'phar://' . $fname;
$a = new Phar($fname);
$a['file1.txt'] = 'hi';
$a['file2.txt'] = 'hi2';
$a['subdir/ectory/file.txt'] = 'hi3';
$a->mount($pname . '/mount', __FILE__);
$a->addEmptyDir('one/level');
$a->extractTo(dirname(__FILE__) . '/extract', 'mount');
$a->extractTo(dirname(__FILE__) . '/extract');
$out = array();
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(dirname(__FILE__) . '/extract', 0x3000), RecursiveIteratorIterator::CHILD_FIRST) as $p => $b) {
    $out[] = $p;
}
sort($out);
foreach ($out as $b) {
    echo "{$b}\n";
}
$a->extractTo(dirname(__FILE__) . '/extract1', 'file1.txt');
var_dump(file_get_contents(dirname(__FILE__) . '/extract1/file1.txt'));
$a->extractTo(dirname(__FILE__) . '/extract1', 'subdir/ectory/file.txt');
var_dump(file_get_contents(dirname(__FILE__) . '/extract1/subdir/ectory/file.txt'));
$a->extractTo(dirname(__FILE__) . '/extract1-2', array('file2.txt', 'one/level'));
var_dump(file_get_contents(dirname(__FILE__) . '/extract1-2/file2.txt'));
var_dump(is_dir(dirname(__FILE__) . '/extract1-2/one/level'));
try {
    $a->extractTo(dirname(__FILE__) . '/whatever', 134);
} catch (Exception $e) {
    echo $e->getMessage(), "\n";
开发者ID:zaky-92,项目名称:php-1,代码行数:31,代码来源:ext_phar_tests_phar_extract.php

示例7: dirname

<?php

$fname = dirname(__FILE__) . '/tempmanifest2.phar.php';
$pname = 'phar://' . $fname;
$phar = new Phar($fname);
$phar->setDefaultStub();
$phar->setAlias('fred');
$phar['file1.txt'] = 'hi';
$phar['file2.txt'] = 'hi2';
$phar['subdir/ectory/file.txt'] = 'hi3';
$phar->mount($pname . '/mount2', __FILE__);
$phar->addEmptyDir('one/level');
$phar->extractTo(dirname(__FILE__) . '/extract2', 'mount2');
$phar->extractTo(dirname(__FILE__) . '/extract2');
$out = array();
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(dirname(__FILE__) . '/extract2', 0x3000), RecursiveIteratorIterator::CHILD_FIRST) as $path => $file) {
    $extracted[] = $path;
}
sort($extracted);
foreach ($extracted as $out) {
    echo "{$out}\n";
}
?>
===DONE===
<?php 
@unlink(dirname(__FILE__) . '/tempmanifest2.phar.php');
$dir = dirname(__FILE__) . '/extract2/';
@unlink($dir . 'file1.txt');
@unlink($dir . 'file2.txt');
@unlink($dir . 'subdir/ectory/file.txt');
@rmdir($dir . 'subdir/ectory');
开发者ID:alphaxxl,项目名称:hhvm,代码行数:31,代码来源:phar_extract2.php

示例8: Phar

<?php

$p = new Phar(__FILE__);
var_dump(isset($p["mounted"]));
Phar::mount("mounted", "phar://" . __FILE__ . "/test.txt");
var_dump(isset($p["mounted"]));
echo $p["mounted"]->getContent(), "\nok\n";
__halt_compiler(); ?>
6test.txt€ισH©ΐEΆ<?php __HALT_COMPILER();?f}oe/y»NLYι,*΄�GBMB
开发者ID:gleamingthecube,项目名称:php,代码行数:9,代码来源:ext_phar_tests_cache_list_copyonwrite25.phar.php

示例9: var_dump

<?php

var_dump(file_exists("phar://" . __FILE__ . "/test.txt"));
clearstatcache();
Phar::mount("test.txt", "phar://" . __FILE__ . "/tobemounted");
var_dump(file_exists("phar://" . __FILE__ . "/test.txt"), file_get_contents("phar://" . __FILE__ . "/test.txt"));
echo "ok\n";
__halt_compiler(); ?>
9tobemounted���H�*�ضhi�����X���PF�.��3GBMB
开发者ID:gleamingthecube,项目名称:php,代码行数:9,代码来源:ext_phar_tests_cache_list_copyonwrite4.phar.php

示例10:

require REDBEANPHP_MAIN_DIR . 'Repository/Frozen.php';
//Load Core functionality
require REDBEANPHP_MAIN_DIR . 'OODB.php';
require REDBEANPHP_MAIN_DIR . 'ToolBox.php';
require REDBEANPHP_MAIN_DIR . 'Finder.php';
//Load extended functionality
require REDBEANPHP_MAIN_DIR . 'AssociationManager.php';
require REDBEANPHP_MAIN_DIR . 'BeanHelper.php';
require REDBEANPHP_MAIN_DIR . 'BeanHelper/SimpleFacadeBeanHelper.php';
/* Developer Comfort */
require REDBEANPHP_MAIN_DIR . 'SimpleModel.php';
require REDBEANPHP_MAIN_DIR . 'SimpleModelHelper.php';
require REDBEANPHP_MAIN_DIR . 'TagManager.php';
require REDBEANPHP_MAIN_DIR . 'LabelMaker.php';
require REDBEANPHP_MAIN_DIR . 'Facade.php';
require REDBEANPHP_MAIN_DIR . 'DuplicationManager.php';
require REDBEANPHP_MAIN_DIR . 'Plugin.php';
require REDBEANPHP_MAIN_DIR . 'Functions.php';
//Allow users to mount the plugin folder.
if (defined('REDBEANPHP_PLUGINS')) {
    Phar::mount('RedBeanPHP/Plugin', REDBEANPHP_PLUGINS);
}
//make some classes available for backward compatibility
class RedBean_SimpleModel extends \RedBeanPHP\SimpleModel
{
}
if (!class_exists('R')) {
    class R extends \RedBeanPHP\Facade
    {
    }
}
开发者ID:cesium147,项目名称:redbean,代码行数:31,代码来源:loader.php

示例11: scandir

/**
 * This file is a part of MyWebSQL package
 *
 * @file:      status.php
 * @author     Samnan ur Rehman
 * @copyright  (c) 2008-2012 Samnan ur Rehman
 * @web        http://mywebsql.net
 * @license    http://mywebsql.net/license
 */
if (defined('MYWEBSQL_COMPACT_DIST')) {
    $files = scandir(BASE_PATH . "/config/");
    foreach ($files as $config) {
        $_cfn = BASE_PATH . '/mywebsql_config/' . basename($config);
        if (file_exists($cfn)) {
            Phar::mount('config/' . basename($config), $_cfn);
        }
    }
}
define('BASE_PATH', dirname(__FILE__));
header("Content-Type: text/html;charset=utf-8");
include_once BASE_PATH . "/lib/session.php";
Session::init();
include_once BASE_PATH . "/config/config.php";
if (defined("TRACE_FILEPATH") && TRACE_FILEPATH && defined("TRACE_MESSAGES") && TRACE_MESSAGES) {
    ini_set("error_log", TRACE_FILEPATH);
}
$status = '[]';
if (!isset($_REQUEST['type']) || !isset($_REQUEST['id'])) {
    die($status);
}
开发者ID:pollin14,项目名称:MyWebSQL,代码行数:30,代码来源:status.php

示例12: 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
开发者ID:gleamingthecube,项目名称:php,代码行数:14,代码来源:ext_phar_tests_front.phar.php


注:本文中的Phar::mount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。