编程语言
首页 > 编程语言> > PHP---反射--继续剖析

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);

 

标签:反射,coach,name,dump,剖析,myinit,var,skill,PHP
来源: https://www.cnblogs.com/saintdingspage/p/11590491.html