ThinkSSL🔒 一键申购 5分钟快速签发 30天无理由退款 购买更放心 广告
这些函数允许你获得许多关于PHP本身的参数,例如:运行时的配置,被加载的扩展,版本等。 你也将找到设置你的运行中的PHP的选项的函数。可能最好用的 PHP- 函数[phpinfo()](https://www.php.net/manual/zh/function.phpinfo.php)可以在这里找到 ## **运行时配置** **PHP 选项/Inf 配置选项** | 名字 | 默认 | 可修改范围 | 更新日志 |描述| | --- | --- | --- | --- | --- | | [assert.active](https://www.php.net/manual/zh/info.configuration.php#ini.assert.active) | "1" | PHP\_INI\_ALL |   |激活[assert()](https://www.php.net/manual/zh/function.assert.php)断言评测| | [assert.bail](https://www.php.net/manual/zh/info.configuration.php#ini.assert.bail) | "0" | PHP\_INI\_ALL |   |失败的断言将中止脚本| | [assert.warning](https://www.php.net/manual/zh/info.configuration.php#ini.assert.warning) | "1" | PHP\_INI\_ALL |   |为每个失败的断言产生一条 PHP 警告信息| | [assert.callback](https://www.php.net/manual/zh/info.configuration.php#ini.assert.callback) | NULL | PHP\_INI\_ALL |   |失败的断言将调用用户的函数| | [assert.quiet\_eval](https://www.php.net/manual/zh/info.configuration.php#ini.assert.quiet-eval) | "0" | PHP\_INI\_ALL |   |在 断言表达式执行时[error\_reporting()](https://www.php.net/manual/zh/function.error-reporting.php)使用当前的设置。 如果启用了,在执行时错误将不会被显示(隐式的 error\_reporting(0))。 如果禁用了,错误将根据[error\_reporting()](https://www.php.net/manual/zh/function.error-reporting.php)的设置来显示| | [assert.exception](https://www.php.net/manual/zh/info.configuration.php#ini.assert.exception) | "0" | PHP\_INI\_ALL | Available since PHP 7.0.0. |在断言(assert)失败时产生**AssertionError**异常。| | [enable\_dl](https://www.php.net/manual/zh/info.configuration.php#ini.enable-dl) | "1" | PHP\_INI\_SYSTEM | 本过时特性*将*肯定会在未来被*移除*。 |该指令仅对 Apache 模块版本的 PHP 有效。 你可以针对每个虚拟机或每个目录开启或关闭[dl()](https://www.php.net/manual/zh/function.dl.php)动态加载 PHP 模块。| | [max\_execution\_time](https://www.php.net/manual/zh/info.configuration.php#ini.max-execution-time) | "30" | PHP\_INI\_ALL |   |这设置了脚本被解析器中止之前允许的最大执行时间,单位秒。 这有助于防止写得不好的脚本占尽服务器资源。 默认设置为*30*。 从[命令行](https://www.php.net/manual/zh/features.commandline.php)运行 PHP 时,默认设置为*0*<br>最大执行时间不会影响系统调用和系统操作等。更多细节参见[set\_time\_limit()](https://www.php.net/manual/zh/function.set-time-limit.php)。<br>在[安全模式](https://www.php.net/manual/zh/ini.sect.safe-mode.php#ini.safe-mode)下你不能通过[ini\_set()](https://www.php.net/manual/zh/function.ini-set.php)来修改此设置。 唯一的解决方法是关闭安全模式或者在php.ini中修改时间限制。<br>你的 web 服务器也可以有其他超时设置,也有可能中断 PHP 的执行。 Apache 有一个*Timeout*指令,IIS 有一个 CGI 超时功能。 他们默认都是 300 秒。更多具体信息参见你的 web 服务器的文档。| | [max\_input\_time](https://www.php.net/manual/zh/info.configuration.php#ini.max-input-time) | "-1" | PHP\_INI\_PERDIR | 自 PHP 4.3.0 起有效。 |脚本解析输入数据(类似 POST 和 GET)允许的最大时间,单位是秒。 它从接收所有数据到开始执行脚本进行测量的| | [max\_input\_nesting\_level](https://www.php.net/manual/zh/info.configuration.php#ini.max-input-nesting-level) | "64" | PHP\_INI\_PERDIR | 自 PHP 4.4.8 and PHP 5.2.3 起有效。 |设置[输入变量](https://www.php.net/manual/zh/language.variables.external.php)的嵌套深度 (例如[$\_GET](https://www.php.net/manual/zh/reserved.variables.get.php),[$\_POST](https://www.php.net/manual/zh/reserved.variables.post.php)……)| | [max\_input\_vars](https://www.php.net/manual/zh/info.configuration.php#ini.max-input-vars) | 1000 | PHP\_INI\_PERDIR | 自 PHP 5.3.9 起有效。 |接受多少[输入的变量](https://www.php.net/manual/zh/language.variables.external.php)(限制分别应用于 $\_GET、$\_POST 和 $\_COOKIE 超全局变量) 指令的使用减轻了以哈希碰撞来进行拒绝服务攻击的可能性。 如有超过指令指定数量的输入变量,将会导致**`E_WARNING`**的产生, 更多的输入变量将会从请求中截断| | [magic\_quotes\_gpc](https://www.php.net/manual/zh/info.configuration.php#ini.magic-quotes-gpc) | "1" | PHP\_INI\_PERDIR | 在 PHP <= 4.2.3 是 PHP\_INI\_ALL,在 PHP 5.4.0 中被移除。 |当 magic\_quotes 为 on,所有的 ' (单引号)、" (双引号)、\\(反斜杠)和 NUL's 被一个反斜杠自动转义| | [magic\_quotes\_runtime](https://www.php.net/manual/zh/info.configuration.php#ini.magic-quotes-runtime) | "0" | PHP\_INI\_ALL | 在 PHP 5.4.0 中移除 |如果启用了`magic_quotes_runtime`,大多数返回任何形式外部数据的函数,包括数据库和文本段将会用反斜线转义引号。 如果启用了[magic\_quotes\_sybase](https://www.php.net/manual/zh/sybase.configuration.php#ini.magic-quotes-sybase),单引号会被单引号转义而不是反斜线| | [zend.enable\_gc](https://www.php.net/manual/zh/info.configuration.php#ini.zend.enable-gc) | "1" | PHP\_INI\_ALL | 自 PHP 5.3.0 起有效。 |启用或禁用循环引用记数搜集器| # 预定义常量 **[phpinfo()](https://www.php.net/manual/zh/function.phpinfo.php)常量** | 常量 | 值 | 描述 | | --- | --- | --- | | **`INFO_GENERAL`** | 1 | 配置行,php.ini的位置、构建日期,Web 服务器、操作系统及其他。 | | **`INFO_CREDITS`** | 2 | PHP 贡献者。参见[phpcredits()](https://www.php.net/manual/zh/function.phpcredits.php)。 | | **`INFO_CONFIGURATION`** | 4 | 当前 PHP 指令的本地(Local)和主(Master)值。参见[ini\_get()](https://www.php.net/manual/zh/function.ini-get.php)。 | | **`INFO_MODULES`** | 8 | 已加载的模块和各自的设置。 | | **`INFO_ENVIRONMENT`** | 16 | 环境变量信息在[$\_ENV](https://www.php.net/manual/zh/reserved.variables.environment.php)中亦有效。 | | **`INFO_VARIABLES`** | 32 | 显示所有*EGPCS*(环境变量、GET、POST、Cookie、Server)中的[预定义变量](https://www.php.net/manual/zh/language.variables.predefined.php)。 | | **`INFO_LICENSE`** | 64 | PHP 版权信息。参见[» license faq](https://www.php.net/license/)。 | | **`INFO_ALL`** | \-1 | 显示以上所有。这是默认值。 | **INI 常量** | 常量 | 值 | 描述 | | --- | --- | --- | | *INI\_USER* | 1 | Unused | | *INI\_PERDIR* | 2 | Unused | | *INI\_SYSTEM* | 4 | Unused | | *INI\_ALL* | 7 | Unused | 断言常量,这些值用于设置[assert\_options()](https://www.php.net/manual/zh/function.assert-options.php)中的断言标记 。 **[assert()](https://www.php.net/manual/zh/function.assert.php)常量** | 常量 | INI 设置 | 描述 | | --- | --- | --- | | **`ASSERT_ACTIVE`** | assert.active | 启用[assert()](https://www.php.net/manual/zh/function.assert.php)。 | | **`ASSERT_CALLBACK`** | assert.callback | 失败断言的回调函数。 | | **`ASSERT_BAIL`** | assert.bail | 断言失败时中止执行。 | | **`ASSERT_WARNING`** | assert.warning | 为每个失败的断言产生一条 PHP 警告。 | | **`ASSERT_QUIET_EVAL`** | assert.quiet\_eval | 在执行断言表达式时禁用*error\_reporting*。 | 以下常量仅在主机操作系统是 Windows的情况下有效,能得到不同版本信息,能够检测利用一些功能。 自 PHP 5.3.0 起有效。 **Windows 特定常量** | 常量 | 描述 | | --- | --- | | **`PHP_WINDOWS_VERSION_MAJOR`** | windows 主版本,可以是*4*(NT4/Me/98/95)、*5*(XP/2003 R2/2003/2000) 或*6*(Vista/2008/7/8/8.1)。 | | **`PHP_WINDOWS_VERSION_MINOR`** | Windows 副版本号,可以是*0*(Vista/2008/2000/NT4/95)、*1*(XP)、*2*(2003 R2/2003/XP x64)、*10*(98) 或*90*(ME)。 | | **`PHP_WINDOWS_VERSION_BUILD`** | Windows 内部版本号(例如 Windows Vista SP1 是 build 6001) | | **`PHP_WINDOWS_VERSION_PLATFORM`** | PHP 当前运行的平台, Windows Vista/XP/2000/NT4、Server 2008/2003 的值是*2*, Windows ME/98/95 下值是*1*。 | | **`PHP_WINDOWS_VERSION_SP_MAJOR`** | 安装的 service pack 主版本号,没有安装是*0*。 例如, Windows XP service pack 3 上这个值是*3*。 | | **`PHP_WINDOWS_VERSION_SP_MINOR`** | 安装的 service pack 副版本号,如果没有安装则是*0*。 | | **`PHP_WINDOWS_VERSION_SUITEMASK`** | The suitemask is a bitmask that can tell if various features of Windows is installed, see the table below for possible bitfield values. | | **`PHP_WINDOWS_VERSION_PRODUCTTYPE`** | This contains the value used to determine the*PHP\_WINDOWS\_NT\_\**constants. This value may be one of the*PHP\_WINDOWS\_NT\_\**constants indicating the platform type. | | **`PHP_WINDOWS_NT_DOMAIN_CONTROLLER`** | 这是域控制器 | | **`PHP_WINDOWS_NT_SERVER`** | 这是一个服务器系统 (eg. Server 2008/2003/2000),注意如果这是一个域控制器,通过**`PHP_WINDOWS_NT_DOMAIN_CONTROLLER`**报告。 | | **`PHP_WINDOWS_NT_WORKSTATION`** | 这是一个工作站系统 (例如 Vista/XP/2000/NT4) | 此功能列表可以通过**`PHP_WINDOWS_VERSION_SUITEMASK`**位掩码检测。 **Windows suitemask 位字段** | Bits | 描述 | | --- | --- | | *0x00000004* | 安装的是 Microsoft BackOffice components。 | | *0x00000400* | 安装的是 Windows Server 2003, Web Edition。 | | *0x00004000* | 安装的是 Windows Server 2003, Compute Cluster Edition。 | | *0x00000080* | 安装的是 Windows Server 2008 Datacenter, Windows Server 2003, Datacenter Edition or Windows 2000 Datacenter Server。 | | *0x00000002* | 安装的是 Windows Server 2008 Enterprise, Windows Server 2003, Enterprise Edition, Windows 2000 Advanced Server 或 Windows NT Server 4.0 Enterprise Edition 。 | | *0x00000040* | 安装的是 Windows XP Embedded。 | | *0x00000200* | 安装的是 Windows Vista Home Premium, Windows Vista Home Basic 或 Windows XP Home Edition。 | | *0x00000100* | Remote Desktop is supported, but only one interactive session is supported. This value is set unless the system is running in application server mode. | | *0x00000001* | Microsoft Small Business Server was once installed on the system, but may have been upgraded to another version of Windows. | | *0x00000020* | Microsoft Small Business Server is installed with the restrictive client license in force. | | *0x00002000* | 安装的是 Windows Storage Server 2003 R2 或 Windows Storage Server 2003。 | | *0x00000010* | 中断服务安装了。这个值总是设置的。如果这个值设置了,但*0x00000100*没有设置,操作系统运行于 application server 模式。 | | *0x00008000* | 安装的是 Windows Home Server。 |