php检测函数是否存在函数 function_exists

php检测函数是否存在函数 function_exists

语法

bool function_exists ( string $function_name )
检查的定义的函数的列表,同时内置(内部)和用户定义的,为function_name。
返回值

如果function_name是一个函数存在,返回true,否则返回false。

if (function_exists('imap_open')) {
    echo "imap functions are available.www.afish.cnblogs.com";
} else {
    echo "imap functions are not available.
n";
}

//function_exists returns false on null and empty string:

if (function_exists('')) {
                echo "empty string function existsn";
}

if (function_exists(null)) {
                echo "null function existsn";
}
 

转载请注明出处!小鱼阁工作室 -专注zencart建站,织梦企业建站,ecshop商城,二次开发,产品采集,模板修改!技术QQ 631992791
原文地址:https://www.cnblogs.com/afish/p/3973535.html