ReflectionClass::getFileName
(PHP 5, PHP 7, PHP 8)
ReflectionClass::getFileName — 获取定义类的文件名
参数
此函数没有参数。
返回值
返回类所定义的文件名。如果这个类是在 PHP 核心或 PHP 扩展中定义的,则返回 false
。
+添加备注
用户贡献的备注 2 notes
robot at znframework dot com ¶
7 years ago
<?php
$a = new \ReflectionClass('ZN\Database\InternalDB');
var_dump($a->getFileName());
// Output: C:\xampp7\htdocs\develop\Internal\Database\DB\InternalDB.php
me at yeganemehr dot net ¶
6 months ago
Please note that returned value from this function is actually realpath of the file and if your file is symlink, target of the link will return.
备份地址:http://www.lvesu.com/blog/php/reflectionclass.getfilename.php