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