預(yù)定義常量

下列常量作為 PHP 核心的一部分總是可用的。

預(yù)定義 phpcredits() 常量
常量 描述
CREDITS_GROUP 1 核心開發(fā)者名單
CREDITS_GENERAL 2 總的貢獻(xiàn):語言設(shè)計和理念,PHP 作者 和 SAPI 模塊。
CREDITS_SAPI 4 PHP 的服務(wù)器 API 模塊列表,以及它們的作者。
CREDITS_MODULES 8 PHP 擴(kuò)展的列表,以及它們的作者。
CREDITS_DOCS 16 文檔組的貢獻(xiàn)。
CREDITS_FULLPAGE 32 通常與其他標(biāo)志組合使用。通過其他標(biāo)志指示了完整獨立的 HTML 頁面,用于打印包含信息。
CREDITS_QA 64 質(zhì)量保證團(tuán)隊的貢獻(xiàn)。
CREDITS_ALL -1 所有的貢獻(xiàn)者,等于使用 CREDITS_DOCS + CREDITS_GENERAL + CREDITS_GROUP + CREDITS_MODULES + CREDITS_QA CREDITS_FULLPAGE。 它以合適的標(biāo)簽產(chǎn)生了完整的獨立 HTML 頁面。這是默認(rèn)的值。
phpinfo() 常量
常量 描述
INFO_GENERAL 1 配置行,php.ini 的位置、構(gòu)建日期,Web 服務(wù)器、操作系統(tǒng)及其他。
INFO_CREDITS 2 PHP 貢獻(xiàn)者。參見 phpcredits()。
INFO_CONFIGURATION 4 當(dāng)前 PHP 指令的本地(Local)和主(Master)值。參見 ini_get()。
INFO_MODULES 8 已加載的模塊和各自的設(shè)置。
INFO_ENVIRONMENT 16 環(huán)境變量信息在 $_ENV 中亦有效。
INFO_VARIABLES 32 顯示所有 EGPCS (環(huán)境變量、GET、POST、Cookie、Server)中的預(yù)定義變量。
INFO_LICENSE 64 PHP 版權(quán)信息。參見 ? license faq。
INFO_ALL -1 顯示以上所有。這是默認(rèn)值。
INI 常量
常量 描述
INI_USER 1 Unused
INI_PERDIR 2 Unused
INI_SYSTEM 4 Unused
INI_ALL 7 Unused

斷言常量,這些值用于設(shè)置 assert_options() 中的斷言標(biāo)記 。

assert() 常量
常量 INI 設(shè)置 描述
ASSERT_ACTIVE assert.active 啟用 assert()。
ASSERT_CALLBACK assert.callback 失敗斷言的回調(diào)函數(shù)。
ASSERT_BAIL assert.bail 斷言失敗時中止執(zhí)行。
ASSERT_WARNING assert.warning 為每個失敗的斷言產(chǎn)生一條 PHP 警告。
ASSERT_QUIET_EVAL assert.quiet_eval 在執(zhí)行斷言表達(dá)式時禁用 error_reporting。

以下常量僅在主機操作系統(tǒng)是 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 內(nèi)部版本號(例如 Windows Vista SP1 是 build 6001)
PHP_WINDOWS_VERSION_PLATFORM PHP 當(dāng)前運行的平臺, 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 這是一個服務(wù)器系統(tǒng) (eg. Server 2008/2003/2000),注意如果這是一個域控制器,通過 PHP_WINDOWS_NT_DOMAIN_CONTROLLER 報告。
PHP_WINDOWS_NT_WORKSTATION 這是一個工作站系統(tǒng) (例如 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 中斷服務(wù)安裝了。這個值總是設(shè)置的。如果這個值設(shè)置了,但 0x00000100 沒有設(shè)置,操作系統(tǒng)運行于 application server 模式。
0x00008000 安裝的是 Windows Home Server。