Home >Backend Development >PHP Tutorial > php基础-define跟defined函数的使用

php基础-define跟defined函数的使用

WBOY
WBOYOriginal
2016-06-13 13:11:501074browse

php基础-define和defined函数的使用

??? define("TEST_ATTR","hhhhhhh");
??? echo TEST_ATTR;

?

define相当于java中的constant用来定义一个常量;

?

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

若常量存在,则返回 true,否则返回 false。

?

define("GREETING","Hello world!");
echo <code>defined("GREETING")</code>
;
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn