该方法存在于类中,当 所调用的类的实例的非静态方法不存在时,则调用该方法:
__call($name, $arguments)
判断某个方法是否存在,如果不存在返回false,存在返回true:
method_exist($object, 'someMethod');
method_exist('className', 'someMethod');
判断某个方法是否可执行:
is_callable(array($object, 'someMethod'));
is_callable(array('className', 'someMethod'));
注:method_exist和is_callable的区别?
method_exist仅仅判断类的方法存不存在,而is_callable判断的是给定方法是否可执行。比如当类中包含__call方法时,表示当调用的类方法不存在时,调用该方法。此时,如果给定方法不存在,method_exist 返回false;而is_callable返回true。