$this->_extends($class);
}
}
}
public function _extends($class_name){
//分析目标
$ref = new ReflectionClass($class_name);
//继承公共属性
$property_list=$ref->getProperties(ReflectionProperty::IS_PUBLIC);
foreach($property_list as $property)
{
$property_name=$property->name;
$property_value=$property->getValue(new $class_name);
if($property_name==='_extends')
{
foreach($property_value as $c)
{
$this->_extends[]=$c;
}
}else{
if(!property_exists($this,$property_name))
{
$this->{$property->name}=$property_value;
}
}
}
//继承公共方法
$method_list=$ref->getMethods(ReflectionMethod::IS_PUBLIC);
foreach($method_list as $method)
{
$this->_extends_method[$method->name]=$method->class;
}
}
function __call($m,$a){
if($c=$this->_extends_method[$m])
{
eval("$c::$m(".'$a'.");");
}
}
}