【php开源代码栏目提醒】:网学会员php开源代码为您提供code4.11.php参考,解决您在code4.11.php学习中工作中的难题,参考学习。
<?php
class MyClass
{ const myAge = 5;
private static $value = MyClass::myAge;
public function GetAge() { return self::$value++; }
}
$method = new ReflectionMethod('MyClass','GetAge');
printf( "这个 %s 方法的特点:<br/>%s方法<br/> %s方法<br/>%s 方法<br/>".
"'%s' (这个方法 %s)<br>" .
" 声明在: %s<br>" .
" 行数从 :%d to %d<br>" .
" 具有的修饰符为: %d[%s]<br>",
$method->isInternal() ? '
系统内置的' : '用户自定义的',
$method->isAbstract() ? ' 抽象' : '普通',
$method->isFinal() ? ' 最终' : '不是最终',
$method->isPublic() ? ' 公共' : '',
$method->getName(),
$method->isConstructor() ? '构造函数' : '普通方法',
$method->getFileName(),
$method->getStartLine(),
$method->getEndline(),
$method->getModifiers(),
implode(' ', Reflection::getModifierNames($method->getModifiers()))
);
?>