ReflectionMethod::invoke
Invoke
&reftitle.description;
public mixedReflectionMethod::invoke
objectnullobject
mixedargs
执行反射的方法。
&reftitle.parameters;
object
如果执行的方法是静态类,那么这个参数传送 null。
args
0,或者传送给方法的参数列表。可以通过这个参数,给方法传送大量的参数。
&reftitle.returnvalues;
返回方法的返回值
&reftitle.errors;
如果 object 并没有包含一个可以使用的类实例,那么将产生
一个 ReflectionException。
如果方法调用失败,也会产生一个 ReflectionException。
&reftitle.examples;
ReflectionMethod::invoke 示例
invoke(new HelloWorld(), 'Mike');
?>
]]>
&example.outputs;
&reftitle.notes;
当需要引用参数时,不能使用 ReflectionMethod::invoke。必须使用
ReflectionMethod::invokeArgs 代替(在参数列表传递引用)。
&reftitle.seealso;
ReflectionMethod::invokeArgs
__invoke()
call_user_func