function callback($object){ if ($object != null && method_exists($object, 'returnData')) { //可以执行到这里 call_user_func_array(array($object, 'returnData'), array(ERROR_SOFT_NO_EXIST)); } }
我在一个类中调用callback($this),method_exists返回true,但随后的call_user_func_array总是报错:Think\Controller:returnData方法不存在!
Think\Controller:returnData是这个类的基类,returnData方法在本类中,怎么才能调用到本类的这个方法,而不是调用基类的方法呢?
回复讨论(解决方案)
已解决,这样调用的方法必须是公开方法
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn