妈妈从拒绝到主动的转变句子,成全视频观看免费高清动漫,一本大道嫩草av无码专区,孕妇流白浆bbw

所在位置:

首頁基礎(chǔ)教程程序代碼PHP判斷{函數(shù)/類/方法/屬性}是否存在

PHP判斷{函數(shù)/類/方法/屬性}是否存在

時間:2019-08-23瀏覽次數(shù):57247TAG:exists  是否  判斷  if  string  存在  

1.php判斷系統(tǒng)函數(shù)或自己寫的函數(shù)是否存在

bool function_exists ( string $function_name ) 判斷函數(shù)是否已經(jīng)定義,例如:

if(function_exists('curl_init')){
   curl_init();
}else{    echo 'not function curl_init';
}

2.php判斷類是否存在

bool class_exists ( string $class_name [, bool $autoload = true ] ) 檢查一個類是否已經(jīng)定義,一定以返回true,否則返回false,例如:

if(class_exists('MySQL')){    $myclass=new MySQL();
}

3.php判斷類里面的某個方法是否已經(jīng)定義

bool method_exists ( mixed $object , string $method_name ) 檢查類的方法是否存在,例如:

$directory=new Directory;if(!method_exists($directory,'read')){    echo '未定義read方法!';
}

4.php 判斷類里面的某個屬性是否已經(jīng)定義

bool property_exists ( mixed $class , string $property )檢查類的屬性是否存在,例如:

$directory=new Directory;if(!property_exists($directory,'li')){    echo '未定義li屬性!';
}


相關(guān)閱讀

Copyright ? 2016眾企業(yè)網(wǎng)站建設(shè)平臺.All Rights Reserved. 閩ICP備15015615號-5   耗時:0.02706s
首頁
菜單
代理
版面
全國
主站蜘蛛池模板: 金秀| 油尖旺区| 徐汇区| 白银市| 工布江达县| 合山市| 万安县| 轮台县| 兴业县| 梅河口市| 花莲市| 勃利县| 安乡县| 南江县| 乌鲁木齐市| 宁乡县| 什邡市| 庄浪县| 天祝| 朝阳市| 桂阳县| 白玉县| 平利县| 敦煌市| 青铜峡市| 榆社县| 新巴尔虎左旗| 五寨县| 翼城县| 涿州市| 保定市| 会宁县| 噶尔县| 九龙县| 武鸣县| 普宁市| 茶陵县| 武平县| 扎兰屯市| 阳春市| 胶州市|