(PHP 5, PHP 7, PHP 8)
ReflectionClass::getMethod — 獲取一個類方法的 ReflectionMethod。
name要反射的方法名稱。
一個 ReflectionMethod。
如果方法不存在則會拋出 ReflectionException 異常。
示例 #1 ReflectionClass::getMethod() 的基本用法
<?php
$class = new ReflectionClass('ReflectionClass');
$method = $class->getMethod('getMethod');
var_dump($method);
?>
以上例程會輸出:
object(ReflectionMethod)#2 (2) {
["name"]=>
string(9) "getMethod"
["class"]=>
string(15) "ReflectionClass"
}