(PHP 5, PHP 7)
ReflectionMethod::getDeclaringClass — 锟斤拷取锟斤拷锟戒函锟斤拷锟斤拷锟矫诧拷锟斤拷锟斤拷锟斤拷锟斤拷
锟斤拷取锟斤拷锟戒函锟斤拷锟斤拷锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷唷� 锟斤拷锟斤拷注锟斤拷应锟斤拷锟角斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟轿伙拷锟斤拷喾碉拷兀锟斤拷锟斤拷牟锟斤拷锟斤拷锟斤拷锟轿拷锟斤拷锟斤拷裕锟� 执锟斤拷锟斤拷锟捷憋拷锟绞裁达拷锟街拷锟斤拷锟斤拷锟斤拷锟侥凤拷锟斤拷锟杰癸拷说锟斤拷一些锟斤拷锟斤拷
锟剿猴拷锟斤拷没锟叫诧拷锟斤拷锟斤拷
锟斤拷锟斤拷 ReflectionClass 锟斤拷锟斤拷锟斤拷锟叫帮拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟�
Example #1 ReflectionMethod::getDeclaringClass() example
<?php
class HelloWorld {
protected function sayHelloTo($name) {
return 'Hello ' . $name;
}
}
$reflectionMethod = new ReflectionMethod(new HelloWorld(), 'sayHelloTo');
var_dump($reflectionMethod->getDeclaringClass());
?>
锟斤拷锟斤拷锟斤拷锟教伙拷锟斤拷锟斤拷锟�
object(ReflectionClass)#2 (1) { ["name"]=> string(10) "HelloWorld" }