PHP 8.5.0 Alpha 2 available for testing

ReflectionClass::getFileName

(PHP 5, PHP 7, PHP 8)

ReflectionClass::getFileNameObtiene el nombre del fichero donde la clase ha sido declarada

Descripción

public ReflectionClass::getFileName(): string|false

Obtiene el nombre del fichero donde la clase ha sido declarada.

Parámetros

Esta función no contiene ningún parámetro.

Valores devueltos

Obtiene el nombre del fichero donde la clase ha sido declarada. Si la clase es declarada en el núcleo de PHP o en una extensión PHP, false es devuelto.

Ver también

add a note

User Contributed Notes 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
11 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