首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

ReflectionClass::getMethod

(PHP 5, PHP 7)

ReflectionClass::getMethod - 获取类方法的ReflectionMethod。

描述

代码语言:javascript
复制
public ReflectionMethod ReflectionClass::getMethod ( string $name )

获取类方法的ReflectionMethod。

参数

name

要反映的方法名称。

返回值

反思方法。

错误/异常

如果该方法不存在,则返回ReflectionException。

例子

Example#1 ReflectionClass::getMethod()的基本用法

代码语言:javascript
复制
<?php
$class = new ReflectionClass('ReflectionClass');
$method = $class->getMethod('getMethod');
var_dump($method);
?>

上面的例子将输出:

代码语言:javascript
复制
object(ReflectionMethod)#2 (2) {
  ["name"]=>
  string(9) "getMethod"
  ["class"]=>
  string(15) "ReflectionClass"
}

另请参阅

  • ReflectionClass::getMethods() - 获取一组方法

← ReflectionClass::getInterfaces

ReflectionClass::getMethods →

扫码关注腾讯云开发者

领取腾讯云代金券