略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: ReflectionClass::getFileName

2025-02-27

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
0
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.

官方地址:https://www.php.net/manual/en/reflectionclass.getfilename.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3