【问题标题】:Get class file name in trait在 trait 中获取类文件名
【发布时间】:2015-08-06 19:18:32
【问题描述】:

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

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

【问题讨论】:

    标签: php file class path traits


    【解决方案1】:

    已解决。 我用过

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-21
      • 1970-01-01
      • 2017-05-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多