update page now

ReflectionClass::getFileName

(PHP 5, PHP 7, PHP 8)

ReflectionClass::getFileNameクラスが定義されているファイルのファイル名を取得する

説明

public ReflectionClass::getFileName(): string|false

クラスが定義されているファイルのファイル名を取得します。

パラメータ

この関数にはパラメータはありません。

戻り値

クラスが定義されているファイルのファイル名を返します。 そのクラスが PHP のコアあるいは PHP の拡張モジュール内で定義されている場合は false を返します。

参考

add a note

User Contributed Notes 2 notes

up
2
robot at znframework dot com
8 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
1 year 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

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant