PHP 教程 PHP defined() 函数

sonny · 2022-03-09 09:45:52 · 热度: 4

实例

检查某常量是否存在:

<?php
define("GREETING","Hello you! How are you today?");
echo defined("GREETING");
?>

定义和用法

defined() 函数检查某常量是否存在。

语法

defined(name)

参数 描述
name 必需。规定要检查的常量的名称。

技术细节

返回值: 如果常量存在,则返回 TRUE,否则返回 FALSE。
PHP 版本: 4+

查看更多 PHP 杂项函数

猜你喜欢:
暂无回复。
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册