反射怎么才能够取得原型名, 而不是值.
比如示例代码, 我怎么取得"CRTINT" 而不是CRTINT所代表的值?
谢谢大家.
<?php
echo '<pre>';
define('CRTINT', '1120');
class test{
public $age1 = CRTINT;
private $age2 = array(CRTINT);
protected $age3 = CRTINT * 87;
protected $age4 = false;
}
$oReflectionClass = new ReflectionClass('test');
$props = array();
$allprops = $oReflectionClass->getDefaultProperties();
$getProperties = $oReflectionClass->getProperties();
foreach($getProperties AS $ps){
$binds = array();
$binds['getval'] = var_export($allprops[$ps->name],true);
$props[$ps->name] = $binds;
}
print_r($props);
http://cn.php.net/manual/zh/m...
不知道这个第一条和你的情况是否一致