function_exists method_exists is_callable 区别和简单实例
Posted jinshao
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了function_exists method_exists is_callable 区别和简单实例相关的知识,希望对你有一定的参考价值。
function_exists() 判断非类的函数是否存在
method_exists() 判断类中是否存在某个方法
is_callable() 判断一个函数或方案是否可以被调用
function aa(){}
function_exists(‘aa‘);//true
class abc{
public static $a =1;
private function ab(){
}
}
var_dump(is_callable([‘abc‘,‘ab‘]));//false
var_dump(method_exists(‘abc‘,‘ab‘));//true
以上是关于function_exists method_exists is_callable 区别和简单实例的主要内容,如果未能解决你的问题,请参考以下文章