在 trait 中获取 class 个文件名

Get class file name in trait

我在 traitA.php 中有 traitA,在 classA.php 中有 classA,它们使用了该特征。

我需要在该特征中获取 classA 文件名。我能以某种方式做到吗? __FILE__ returns traitA.php

已解决。 我用了

$reflection = new ReflectionClass('ClassA');
$classFileName = $reflection->getFileName();