本文整理匯總了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===