downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Exception::getTrace> <Exception::getFile
[edit] Last updated: Fri, 18 Sep 2009

view this page in

Exception::getLine

(PHP 5 >= 5.1.0)

Exception::getLineВзима реда, на който е станало изключението

Описание

final public int Exception::getLine ( void )

Връща номера на реда, на който е било хвърлено изключението.

Параметри

Тази функция няма параметри.

Връщани стойности

Връща номера на реда, на който е било хвърлено изключението.

Примери

Example #1 Пример за Exception::getLine()

<?php
try {
    throw new 
Exception("Някакво съобщение за грешка");
} catch(
Exception $e) {
    echo 
"Съобщението беше хвърлено на ред: " $e->getLine();
}
?>

Примерът по-горе ще изведе нещо подобно на:

Съобщението беше хвърлено на ред: 3



add a note add a note User Contributed Notes Exception::getLine
James 03-Feb-2011 02:20
Note that it appears to be the line number the Exception was created that is returned, *not* the line it was thrown from.

See this bug:
http://bugs.php.net/bug.php?id=53882

Wanted to note that here until documentation is fixed or bug report dealt with.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites