PHP---反射--继续剖析

  • 首先定义一个类
<?php
class mycoach
{
    protected $name;
    protected $age;
    protected $expertise=array();
    public function __construct($name,$age)
    {
        $this->name=$name;
        $this->age=$age;
    }
    public function setskill(Array $skill)
    {
        $this->skill = $skill;
        var_dump($this->skill);
        return (Array) $this->skill;
    }
}
$coach  = new ReflectionClass('mycoach');
if ($coach->isInstantiable())
{
    echo "可以实例化".PHP_EOL;
}
$myinit = $coach->getConstructor();
$dependencies=$myinit->getParameters();
var_dump($dependencies);

 

上一篇:linux 设备树中 dwc3 节点的phys参数含义


下一篇:shell for 循环演示