国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > PHP > 正文

php檢測函數是否存在函數 function_exists

2024-09-04 11:49:02
字體:
來源:轉載
供稿:網友

如果你要判斷一些函數是不是可以用我們可以使用function_exists函數來檢測,下面我們來看幾個例子,希望對你會有幫助.

語法:bool function_exists(string $function_name)

檢查的定義的函數的列表,同時內置(內部)和用戶定義的為function_name.

返回值:返回true,如果function_name存在,是一個函數,否則返回false,實例代碼如下:

  1. if (function_exists('imap_open')) { 
  2.     echo "imap functions are available.www.survivalescaperooms.com<br /> "
  3. else { 
  4.     echo "imap functions are not available.<br /> "
  5. //function_exists returns false on null and empty string: 
  6.  
  7. if (function_exists('')) { 
  8.                 echo "empty string function exists "
  9.         } 
  10.  
  11.         if (function_exists(null)) { 
  12.                 echo "null function exists "
  13.         } 

如果您使用suhosin.executor.func.blacklist而不是在你的php.ini disabled_functions,function_exists將返回true為功能,我用這個有與suhosin.executor.func.blacklist和disabled_functions相同beahviour,實例代碼如下:

  1. function suhosin_function_exists($func) { 
  2.     if (extension_loaded('suhosin')) { 
  3.         $suhosin = @ini_get("suhosin.executor.func.blacklist"); 
  4.         if (emptyempty($suhosin) == false) { 
  5.             $suhosin = explode(','$suhosin); 
  6.             $suhosin = array_map('trim'$suhosin); 
  7.             $suhosin = array_map('strtolower'$suhosin); 
  8.             return (function_exists($func) == true && array_search($func$suhosin) === false); 
  9.         } 
  10.     } 
  11.     return function_exists($func); 
  12. }

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 万全县| 兴化市| 冕宁县| 西昌市| 且末县| 许昌县| 密山市| 赤峰市| 大埔县| 历史| 霍山县| 山阳县| 朔州市| 基隆市| 岢岚县| 丹东市| 安泽县| 那坡县| 吉安市| 元氏县| 安顺市| 夹江县| 漳州市| 囊谦县| 汶上县| 久治县| 遂川县| 石台县| 淮南市| 高密市| 茂名市| 天峨县| 衡山县| 浠水县| 乐陵市| 天津市| 咸丰县| 寻甸| 肥西县| 海南省| 大埔县|