(PHP 4, PHP 5, PHP 7)
define — 定义一个常量
成功时返回 TRUE
, 或者在失败时返回 FALSE
。
Example #1 定义常量
<?php
define("CONSTANT", "Hello world.");
echo CONSTANT; // outputs "Hello world."
echo Constant; // outputs "Constant" and issues a notice.
define("GREETING", "Hello you.", true);
echo GREETING; // outputs "Hello you."
echo Greeting; // outputs "Hello you."
?>