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


PHP PharData::convertToExecutable方法代码示例

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


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

示例1: dirname

<?php

Phar::interceptFileFuncs();
is_file();
is_link();
var_dump(is_file(__FILE__));
$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.tar';
$fname3 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
copy(dirname(__FILE__) . '/tar/files/links.tar', $fname2);
$a = new PharData($fname2);
$b = $a->convertToExecutable();
unset($a);
Phar::unlinkArchive($fname2);
$b['foo/stat.php'] = '<?php
echo "is_link\\n";
var_dump(is_link("./stat.php"),is_file("./stat.php"), is_link("./oops"), is_file("./oops"));
var_dump(is_link("testit/link"), filetype("testit/link"), filetype("testit"), is_file("testit/link"));
echo "not found\\n";
var_dump(is_link("notfound"));
echo "dir\\n";
var_dump(is_dir("./bar"), is_file("foo/bar/blah"));
?>';
$b->addEmptyDir('foo/bar/blah');
$b->setStub('<?php
include "phar://" . __FILE__ . "/foo/stat.php";
__HALT_COMPILER();');
include $fname3;
?>
===DONE===
<?php 
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar');
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:stat2.php

示例2: dirname

<?php

Phar::interceptFileFuncs();
is_file();
is_link();
var_dump(is_file(__FILE__));
$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.tar';
$fname3 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
copy(dirname(__FILE__) . '/tar/files/links.tar', $fname2);
$a = new PharData($fname2);
$b = $a->convertToExecutable(Phar::TAR, Phar::NONE, '.3.phar.tar');
unset($a);
Phar::unlinkArchive($fname2);
$b['foo/stat.php'] = '<?php
echo "is_link\\n";
var_dump(is_link("./stat.php"),is_file("./stat.php"), is_link("./oops"), is_file("./oops"));
var_dump(is_link("testit/link"), filetype("testit/link"), filetype("testit"), is_file("testit/link"));
echo "not found\\n";
var_dump(is_link("notfound"));
echo "dir\\n";
var_dump(is_dir("./bar"), is_file("foo/bar/blah"));
?>';
$b->addEmptyDir('foo/bar/blah');
$b->setStub('<?php
include "phar://" . __FILE__ . "/foo/stat.php";
__HALT_COMPILER();');
include $fname3;
?>
===DONE===
开发者ID:gleamingthecube,项目名称:php,代码行数:29,代码来源:ext_phar_tests_stat2_5.3.php

示例3: Phar

include 'files/phar_test.inc';
$phar = new Phar($fname);
$zip = $phar->convertToData(Phar::ZIP);
echo $zip->getPath() . "\n";
$tgz = $phar->convertToData(Phar::TAR, Phar::GZ);
echo $tgz->getPath() . "\n";
$tbz = $phar->convertToData(Phar::TAR, Phar::BZ2);
echo $tbz->getPath() . "\n";
try {
    $phar = $tbz->convertToExecutable(Phar::PHAR, Phar::NONE);
} catch (Exception $e) {
    echo $e->getMessage() . "\n";
}
copy($tbz->getPath(), $fname2);
$tbz = new PharData($fname2);
$phar = $tbz->convertToExecutable(Phar::PHAR, Phar::NONE);
echo $phar->getPath() . "\n";
$phar['a'] = 'hi';
$phar['a']->setMetadata('hi');
$zip = $phar->convertToExecutable(Phar::ZIP);
echo $zip->getPath() . "\n";
echo $zip['a']->getMetadata() . "\n";
$data = $zip->convertToData();
echo $data->getPath() . "\n";
// extra code coverage
try {
    $data->setStub('hi');
} catch (Exception $e) {
    echo $e->getMessage() . "\n";
}
try {
开发者ID:gleamingthecube,项目名称:php,代码行数:31,代码来源:ext_phar_tests_phar_convert_again.php


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