欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

php通過function_exists檢測函數(shù)是否存在的方法

 更新時間:2015年03月18日 09:24:33   作者:work24  
這篇文章主要介紹了php通過function_exists檢測函數(shù)是否存在的方法,實例分析了php使用function_exists檢測函數(shù)是否存在及調(diào)用的相關(guān)技巧,非常具有實用價值,需要的朋友可以參考下

本文實例講述了php通過function_exists檢測函數(shù)是否存在的方法。分享給大家供大家參考。具體分析如下:

php中可以通過function_exists()函數(shù)檢測另外一個函數(shù)是否存在,可以把函數(shù)名作為一個字符串傳入function_exists,判斷該還是是否存在

function highlight( $txt ) {
  return "<sub>$txt</sub>";
}
function textWrap( $tag, $txt, $func="" ) {
 if (function_exists( $func ) )
  $txt = $func($txt);
  return "<$tag>$txt</$tag>\n";
}

用法示例如下:

echo textWrap('i','function exists Demo','highlight');
//輸出結(jié)果為斜體字的: function exists Demo

希望本文所述對大家的php程序設(shè)計有所幫助。

相關(guān)文章

最新評論