天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

探討php define()函數(shù)及defined()函數(shù)使用詳解

The define() function defines a constant.
define()函數(shù)的作用是:定義一個(gè)常量。

Constants are much like variables, except for the following differences:
常量[constant]與變量[variable]有很多相似的地方,因此,很容易混淆;下面,我們列舉一下常量[constant]與變量[variable]之間的不同點(diǎn):
    A constant's value cannot be changed after it is set
    一個(gè)常量值在指定之后就不可以更改;
    Constant names do not need a leading dollar sign ($)
    設(shè)置常量時(shí),不需要在前面加上“$”符號(hào);
    Constants can be accessed regardless of scope
    常量可以被所有范圍的域訪問(wèn);
    Constant values can only be strings and numbers
    常量的值只能是“字符串[string]”和“數(shù)字[number]”;

Syntax
語(yǔ)法
define(name,value,case_insensitive)

Parameter
參數(shù)
Description
描述
nameRequired. Specifies the name of the constant
必要參數(shù)。指定常量的名稱(chēng)
valueRequired. Specifies the value of the constant
必要參數(shù)。指定常量的值
case_insensitiveOptional. Specifies whether the constant name should be case-insensitive. If set to TRUE, the constant will be case-insensitive. Default is FALSE (case-sensitive)
可選參數(shù)。指定常量的名稱(chēng)是否是不區(qū)分大小寫(xiě)的[case-insensitive]。如果設(shè)置為T(mén)rue,則不區(qū)分字母大小寫(xiě);如果設(shè)置為False,則區(qū)分字母大小寫(xiě)。默認(rèn)值是:False

Example 1
案例1
Define a case-sensitive constant:
指定一個(gè)常量(區(qū)分大小寫(xiě)):
復(fù)制代碼 代碼如下:
<?phpdefine("GREETING","Hello you! How are you today?");echo constant("GREETING");?>

The output of the code above will be:
上述代碼將輸出下面的結(jié)果:
復(fù)制代碼 代碼如下:
Hello you! How are you today?

Example 2
案例2
Define a case-insensitive constant:
指定一個(gè)常量(不區(qū)分大小寫(xiě)):
復(fù)制代碼 代碼如下:
<?phpdefine("GREETING","Hello you! How are you today?",TRUE);echo constant("greeting");?>

The output of the code above will be:
上述代碼將輸出下面的結(jié)果:
復(fù)制代碼 代碼如下:
Hello you! How are you today?

The defined() function checks whether a constant exists.
defined()函數(shù)的作用是:檢查一個(gè)常量是否存在。

Returns TRUE if the constant exists, or FALSE otherwise.
如果該常量存在,則返回True;如果不存在,則返回False。
Syntax
語(yǔ)法
復(fù)制代碼 代碼如下:
defined(name)

Parameter
參數(shù)
Description
描述
nameRequired. Specifies the name of the constant to check
必要參數(shù)。指定常量對(duì)象的名稱(chēng)

Example
案例
復(fù)制代碼 代碼如下:
<?phpdefine("GREETING","Hello you! How are you today?");echo defined("GREETING");?>

The output of the code above will be:
上述代碼將輸出下面的結(jié)果:
1

php技術(shù)探討php define()函數(shù)及defined()函數(shù)使用詳解,轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 视频成人永久免费下载 | 午夜神器老司机高清无码 | 久久99热狠狠色一区二区 | 被爽到叫呻呤视频免费视频 | 精品无码一区二区三区不卡 | 中文国产成人精品久久免费 | 精品熟女少妇AV免费观看 | 国产精品7777人妻精品冫 | 免费观看美女的网站 | 2020国产成人精品视频人 | 国产精品嫩草影院一区二区三区 | 国产色情短视频在线网站 | 国产精品久久久久久日本 | 国产亚洲美女精品久久久2020 | 秋霞电影院兔费理论观频84mb | 婷婷久久综合九色综合伊人色 | 午理论理影片被窝 | 久久精品视频91 | 最近韩国日本免费观看mv免费版 | 成人AV无码一二二区视频免费看 | 日韩精品一卡二卡三卡四卡2021 | 久久精品中文字幕有码日本 | 中文字幕在线不卡精品视频99 | 香蕉99久久久久成人麻豆 | 国产大片51精品免费观看 | 国产精品高清在线观看地址 | 男人把女人桶到高潮嗷嗷叫 | 久99re视频9在线观看 | 国产婷婷色一区二区三区在线 | 强行撕开衣服捏胸黄文 | 777福彩社区 | 成人伦理影院 | 国产剧情在线精品视频不卡 | 国模啪啪久久久久久久 | 偷柏自拍亚洲综合在线 | 暖暖高清视频免费 | 手机在线观看无码日韩视频 | 天天日免费观看视频一1 | 久久4k岛国高清一区二区 | 美女扒开尿口让男生添动态图 | 国产无遮挡又黄又爽在线视频 |