ReflectionClass::getFileName
(PHP 5, PHP 7, PHP 8)
ReflectionClass::getFileName — 获取定义类的文件名
说明
public ReflectionClass::getFileName(): string
获取类被定义的文件的文件名。
参数
此函数没有参数。
返回值
返回类所定义的文件名。如果这个类是在 PHP 核心或 PHP 扩展中定义的,则返回 false
。

User Contributed Notes 1 note
robot at znframework dot com ¶
4 years ago
<?php
$a = new \ReflectionClass('ZN\Database\InternalDB');
var_dump($a->getFileName());
// Output: C:\xampp7\htdocs\develop\Internal\Database\DB\InternalDB.php
备份地址:http://www.lvesu.com/blog/php/reflectionclass.getfilename.php