2013-04-22 64 views
0
<?php 
class Testing 
{ 
    final public static function foo() 
    { 
     return; 
    } 
    public function bar() 
    { 
     return; 
    } 
} 

$foo = new ReflectionMethod('Testing', 'foo'); 

echo "Modifiers for method foo():\n"; 
echo $foo->getModifiers() . "\n"; 
echo implode(' ', Reflection::getModifierNames($foo->getModifiers())) . "\n"; 

$bar = new ReflectionMethod('Testing', 'bar'); 

echo "Modifiers for method bar():\n"; 
echo $bar->getModifiers() . "\n"; 
echo implode(' ', Reflection::getModifierNames($bar->getModifiers())); 
?> 

上面的代碼是從實例#採取PHP手冊1 ReflectionMethod::getModifiers()例如:http://php.net/manual/en/reflectionmethod.getmodifiers.php試圖瞭解getModifiers()在PHP

問題: 代碼:$foo->getModifiers(),輸出爲261,這是什麼意思?

回答