Phar::interceptFileFuncs() - Phar类
Phar::interceptFileFuncs()
(PHP 5 >= 5.3.0, PHP 7, PECL phar >= 2.0.0)
Instructs phar to intercept fopen, file_get_contents, opendir, and all of the stat-related functions
说明
finalpublicstaticPhar::interceptFileFuncs(void): voidinstructs phar to intercept fopen(),readfile(),file_get_contents(),opendir(), and all of the stat-related functions. If any of these functions is called from within a phar archive with a relative path, the call is modified to access a file within the phar archive. Absolute paths are assumed to be attempts to load external files from the filesystem.
This function makes it possible to run PHP applications designed to run off of a hard disk as a phar application.
参数
No parameters.
返回值
范例
A Phar::interceptFileFuncs() example
Assuming that this phar is at/path/to/myphar.pharand it containsfile.phpandfile2.txt, iffile.phpcontains this code:
A Phar::interceptFileFuncs() example
Normally PHP would search the current directory forfile2.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 bephar:///path/to/myphar.phar/and so opensphar:///path/to/myphar.phar/file2.txtin the above example code.
鹏仔微信 15129739599 鹏仔QQ344225443 鹏仔前端 pjxi.com 共享博客 sharedbk.com
图片声明:本站部分配图来自网络。本站只作为美观性配图使用,无任何非法侵犯第三方意图,一切解释权归图片著作权方,本站不承担任何责任。如有恶意碰瓷者,必当奉陪到底严惩不贷!