- 首先定义一个类
<?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);