CakeFest 2024: The Official CakePHP Conference

ReflectionClass::getFileName

(PHP 5, PHP 7, PHP 8)

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

説明

public ReflectionClass::getFileName(): string|false

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

パラメータ

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

戻り値

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

参考

add a note

User Contributed Notes 1 note

up
3
robot at znframework dot com
6 years ago
<?php

$a
= new \ReflectionClass('ZN\Database\InternalDB');

var_dump($a->getFileName());

// Output: C:\xampp7\htdocs\develop\Internal\Database\DB\InternalDB.php
To Top