(PHP 8 >= 8.3.0)
ReflectionMethod::createFromMethodName — 创建一个新的 ReflectionMethod
创建一个新的 ReflectionMethod。
method类名和方法名由 :: 分隔。
成功时返回一个新的 ReflectionMethod。
如果给定的方法不存在,则抛出 ReflectionException。
示例 #1 ReflectionMethod::createFromMethodName() 示例
<?php
class Foo {
public function bar() {
}
}
$methodInfo = ReflectionMethod::createFromMethodName("Foo::bar");
var_dump($methodInfo);
?>以上示例将输出
object(ReflectionMethod)#1 (2) {
["name"]=>
string(3) "bar"
["class"]=>
string(3) "Foo"
}