PHP defined() 函数

定义和用法
defined() 函数检查某常量是否存在。
若常量存在,则返回 true,否则返回 false。
语法
defined(name)
参数 | 描述 |
---|---|
name | 必需。规定要检查的常量的名称。 |
例子
<?php
define("GREETING","Hello world!");
echo defined("GREETING");
?>
define("GREETING","Hello world!");
echo defined("GREETING");
?>
输出:
1
