PHP判定一个常量是否被定义

版权声明:转载请注明出处http://blog.csdn.net/xuaho0907 https://blog.csdn.net/xuaho0907/article/details/82557172

defined()函数可以帮助我们判断一个常量是否已经定义,其语法格式为:

bool defined(string constants_name)

它只有参数constant_name,指的是要获取常量的名称,若存在则返回布尔类型true,否则返回布尔类型false; (注:bool表示函数返回值类型为布尔类型)

猜你喜欢

转载自blog.csdn.net/xuaho0907/article/details/82557172
今日推荐