复制代码 代码如下:
class test{
private $name;
private $sex;
function __construct(){
$this->aaa='aaa';
}
}
$test=new test();
$reflect=new ReflectionClass($test);
$pro=$reflect->getDefaultProperties();
print_r($pro);//打印结果:Array ( [name] => [sex] => )
echo $test->aaa;//打印结果:aaa
复制代码 代码如下:
<?php
class test{
private $name;
private $sex;
function __construct(){
$this->aaa='aaa';
}
}
$test=new test();
$reflect=new ReflectionObject($test);
$pro=$reflect->getProperties();
print_r($pro);
新闻热点
疑难解答