[FX.php List] Getting line number and file name for error reporting

Nick whatdoyouwant at gmail.com
Wed Sep 12 13:03:35 MDT 2007


you could do $_SERVER['SCRIPT_NAME'] to get the name of the page, or
$_SERVER['REQUEST_URI']

as for the line number, the function you would use is
http://us3.php.net/manual/en/function.debug-backtrace.php



On 9/12/07, Troy Meyers <tcmeyers at troymeyers.com> wrote:
>
> I'm working on a single error-handler page that I'd like to be able use
> for numerous situations originating in various PHP files.
>
> Is there PHP function or a way to get the current file name and line
> number --  of where the function is called? I'd like to be able to get that
> at various spots where I check for undesirable situations and pass that info
> to the error page so I can diagnose what happened. I'd like a function to
> get it so that if I change a file name or add lines it reports appropriately
> instead of me having to hard-code descriptions or file names. I've browsed
> the function list, but I don't spot anything.
>
> -Troy
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20070912/0f3bf7be/attachment.html


More information about the FX.php_List mailing list