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

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

WBOY
Release: 2016-06-13 10:49:37
Original
1102 people have browsed it

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>;
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template