本文整理汇总了PHP中Phar::interceptFileFuncs方法的典型用法代码示例。如果您正苦于以下问题:PHP Phar::interceptFileFuncs方法的具体用法?PHP Phar::interceptFileFuncs怎么用?PHP Phar::interceptFileFuncs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phar
的用法示例。
在下文中一共展示了Phar::interceptFileFuncs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Initialize the loader object.
*
* @param ClassLoader $composerInstance
* @param callable $finderFactory
* @param \ArrayAccess $factoryRepository
*/
public function __construct(ClassLoader $composerInstance, callable $finderFactory, \ArrayAccess $factoryRepository)
{
$this->composerInstance = $composerInstance;
$this->factoryRepository = $factoryRepository;
$this->finderFactory = $finderFactory;
if (\class_exists('\\Phar', false)) {
//instructs phar to intercept fopen(), file_get_contents(), opendir(), and all of the stat-related functions
//Needed to support Phar with the loader
\Phar::interceptFileFuncs();
}
}
示例2: fread
<?php
Phar::interceptFileFuncs();
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
fopen(array(), 'r');
chdir(dirname(__FILE__));
file_put_contents($fname, "blah\n");
file_put_contents("foob", "test\n");
$a = fopen($fname, 'rb');
echo fread($a, 1000);
fclose($a);
unlink($fname);
mkdir($pname . '/oops');
file_put_contents($pname . '/foo/hi', '<?php
$context = stream_context_create();
$a = fopen("foob", "rb", false, $context);
echo fread($a, 1000);
fclose($a);
fopen("../oops", "r");
?>
');
include $pname . '/foo/hi';
?>
===DONE===