当前位置: 首页> 函数类别大全> get_included_files

get_included_files

返回被 include 和 require 文件名的 array
名称:get_included_files
分类:PHP选项和信息
所属语言:php
一句话介绍:返回被 include 和 require 文件名的 array

get_included_files 函数

适用PHP版本

PHP 4.3.0及以上版本

函数说明

get_included_files 函数返回一个数组,包含当前脚本已包含的所有文件路径。此函数用于查看哪些文件已经通过 includerequire 被加载到当前脚本中。

函数语法

array get_included_files(void);

参数

此函数不接受任何参数。

返回值

返回一个数组,数组中每个元素是一个已被包含文件的完整路径。如果没有文件被包含,则返回空数组。

示例

以下示例演示了如何使用 get_included_files 来获取当前脚本已包含的文件列表:

示例代码

  // 包含一些文件
  include 'file1.php';
  require 'file2.php';
<p>// 获取已包含的文件<br>
$included_files = get_included_files();</p>
<p>// 输出包含的文件列表<br>
print_r($included_files);<br>

示例代码的说明

在这个例子中,首先通过 includerequire 包含了两个文件,分别为 'file1.php' 和 'file2.php'。然后,调用 get_included_files 函数获取包含的文件列表,并通过 print_r 输出包含文件的路径数组。

运行此代码时,输出会是类似于以下内容:

  Array
  (
      [0] => /path/to/file1.php
      [1] => /path/to/file2.php
  )
  
同类函数
  • 获取所有配置选项 ini_get_all

    ini_get_all

    获取所有配置选项
  • 回收 Zend 引擎内存管理器使用的内存 gc_mem_caches

    gc_mem_caches

    回收Zend引擎内存管理器使用的内存
  • 设置配置选项的值 ini_set

    ini_set

    设置配置选项的值
  • 返回一 个扩展的所有函数名称的数组 get_extension_funcs

    get_extension_funcs

    返回一个扩展的所有函数名称的数组
  • 获取一个配置选项的值 ini_get

    ini_get

    获取一个配置选项的值
  • 设置include_path配置选项 set_include_path

    set_include_path

    设置include_path配置选项
  • 返回当前线程的唯一识别符 zend_thread_id

    zend_thread_id

    返回当前线程的唯一识别符
  • 获取环境变量的值 getenv

    getenv

    获取环境变量的值
热门文章