1
我想找到通过扩充传递给函数的令牌名称。用反射API获取令牌名称
class Norm
{
const STR_NORM = 0;
const INT_NORM = 0;
}
function foo($Arg1, $Arg2 = NULL)
{
getConstName($Arg1); # Should Return STR_NORM;
return $Arg1, $Arg2;
}
echo foo(Norm::STR_NORM);
有什么办法通过PHP Reflection API来实现getConstName吗?
好点。我必须考虑他们的问题。 – 2010-04-25 17:47:33
我认为通常的解决方案是将每个常量设置为不同的值。 – 2010-04-25 18:34:41