Phar::interceptFileFuncs
(PHP >= 5.3.0, PECL phar >= 2.0.0)
Phar::interceptFileFuncs — instructs phar to intercept fopen, file_get_contents, opendir, and all of the stat-related functions
Описание
void Phar::interceptFileFuncs
( void
)
This function makes it possible to run PHP applications designed to run off of
a hard disk as a phar application.
Список параметров
No parameters.
Примеры
Пример #1 A Phar::interceptFileFuncs() example
<?php
Phar::interceptFileFuncs();
include 'phar://' . __FILE__ . '/file.php';
?>
Assuming that this phar is at /path/to/myphar.phar and it
contains file.php and
file2.txt, if file.php contains this code:
Пример #2 A Phar::interceptFileFuncs() example
<?php
echo file_get_contents('file2.txt');
?>
Normally PHP would search the current directory for file2.txt,
which would translate as the directory of file.php, or the current directory of
a command-line user. Phar::interceptFileFuncs() instructs
PHP to consider the current directory to be phar:///path/to/myphar.phar/
and so opens phar:///path/to/myphar.phar/file2.txt in the above
example code.