ReflectionClass::getFileName

(PHP 5, PHP 7, PHP 8)

ReflectionClass::getFileName获取定义类的文件名

说明

public ReflectionClass::getFileName(): string|false

获取类被定义的文件的文件名。

参数

此函数没有参数。

返回值

返回类所定义的文件名。如果这个类是在 PHP 核心或 PHP 扩展中定义的,则返回 false

参见

添加备注

用户贡献的备注 2 notes

up
2
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
up
1
me at yeganemehr dot net
10 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.
To Top