Index.php加载了Thinkphp.php文件 ---> ThinkPHP.php执行Think.start() ---> Think.class.php中执行App::run() ---> App.class.php中执行 App::exec() --->App::exec()中用反射方法调用了控制器 get_included_files() 此函数是打印在项目流程执行过程中被引入的文件 <?phpnamespaceHome\Controller; ...
Index.php加载了Thinkphp.php文件 ---> ThinkPHP.php执行Think.start() ---> Think.class.php中执行App::run() ---> App.class.php中执行 App::exec() --->App::exec()中用反射方法调用了控制器 get_included_files() 此函数是打印在项目流程执行过程中被引入的文件 <?phpnamespaceHome\Controller; ...
PHP判断文件是否被引入的方法get_included_files <?php // 本文件是 abc.php include 'test1.php'; include_once 'test2.php'; require 'test3.php'; require_once 'test4.php'; $included_files = get_included_files(); foreach ($included_files as $filename) { echo "$filename\n"; } ?> ...
php// 本文件是 abc.phpinclude'test1.php';include_once'test2.php';require'test3.php';require_once'test4.php';$included_files=get_included_files();foreach($included_filesas$filename) {echo"$filename\n"; }?> 结果: 以上例程会输出: abc.php test1.php test2.php test3.php test4.php ...
"Gets the names of all files that have been included using include, include_once, require or require_once." https://www.php.net/manual/en/function.get-included-files.php You can get the directories that have included files like this: array_map("dirname",get_included_files()); Share ...
if( get_included_files()[0] == __FILE__ ){ echo '2.php direct access'; }else{ echo '2.php was included'; } EDIT: See Tim answer, so if you have a prepend include (cf php.ini) use this: if( (!ini_get('auto_prepend_file') && get_included_files()[0] === __F...
无参数获取信息:get_defined_vars()返回一个包含所有已定义变量列表的多维数组、get_defined_constants()返回当前所有已定义的常量名和值、get_defined_functions()返回一个包含所有已定义函数列表的多维数组、get_included_files()返回所有被包含的文件名
get_extension_funcs get_included_files get_include_path get_loaded_extensions get_magic_quotes_gpc get_magic_quotes_runtime get_required_files get_resources goto highlight_file highlight_string if ignore_user_abort include include_once ini_alter ini_get ini_get_all ini_restore ini_set magic_qu...
Create and Use PHP Archive files. Contribute to pear/PHP_Archive development by creating an account on GitHub.
Before you rush off to change all your includes and requires into readfiles or fpassthrus let’s run the same test with a smaller (32Kb file). 32Kb is a more realistic size for an included file. readfile and fpassthru have once again tied for first place. This new set of results just...