The define() function defines a constant.
define()函数的作用是:定义一个常量。
语法 :
define(name,value,case_insensitive) Parameter Description 参数 描述 name Required. Specifies the name of the constant(必要参数。指定常量的名称) value Required. Specifies the value of the constant(必要参数。指定常量的值) case_insensitive 可选参数。指定常量的名称是否是不区分大小写的[case-insensitive]。如果设置为True, 则不区分字母大小写;如果设置为False,则区分字母大小写。默认值是:False
Example 1
案例1
指定一个常量(区分大小写):
<?phpdefine("GREETING","Hello you! How are you today?");echo constant("GREETING");?> 上述代码将输出下面的结果: Hello you! How are you today?
Example 2
案例2
指定一个常量(不区分大小写):
<?phpdefine("GREETING","Hello you! How are you today?",TRUE);echo constant("greeting");?> 上述代码将输出下面的结果: Hello you! How are you today?