PHP 中的 constant() 函数
constant() 函数返回常量的值。
语法
constant(const)
参数
const − 设置要查询的常量的名称
返回
constant() 函数返回一个常量的值,如果常量未定义,则返回 NULL。
示例
以下是定义常量的示例。
<?php
define("myConstant","This is it!");
echo constant("myConstant");
?>输出
以下是输出。
This is it!
广告
constant() 函数返回常量的值。
constant(const)
const − 设置要查询的常量的名称
constant() 函数返回一个常量的值,如果常量未定义,则返回 NULL。
以下是定义常量的示例。
<?php
define("myConstant","This is it!");
echo constant("myConstant");
?>以下是输出。
This is it!