LonghornPHP 2026

Error::getLine

(PHP 7, PHP 8)

Error::getLineObtener la línea en la que ocurrió el error

Descripción

final public function Error::getLine(): int

Obtiene el número de línea donde ocurrió el error.

Parámetros

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

Valores devueltos

Devuelve el número de línea en la que ocurrió el error.

Ejemplos

Ejemplo #1 Ejemplo de Error::getLine()

<?php
try {
 throw new Error("Un mensaje de error");
} catch(Error $e) {
 echo "El error se ocasionó en la línea: " . $e->getLine();
}
?>

Resultado del ejemplo anterior es similar a:

El error se ocasionó en la línea: 3

Véase también

Found A Problem?

Learn How To Improve This PageSubmit a Pull RequestReport a Bug
+add a note

User Contributed Notes

There are no user contributed notes for this page.

AltStyle によって変換されたページ (->オリジナル) /