实际上就是应用了类的反射机制
class a{ public $a; protected $b; private $c; } $func = new ReflectionClass('a'); //所要查询的类名 echo $func->getFileName();
参考:https://blog.csdn.net/zyddj123/article/details/78454578