How to find out what PHP error was printed?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BaKo
    New Member
    • Sep 2007
    • 11

    How to find out what PHP error was printed?

    Hey. My script uses file_get_conten ts, and i get two errors with it. Sometimes I get an error saying the site cant be reached or is invalid, and other times i get an error saying it got an internet server error when accessing the site. Is it possible to determine which error file_get_conten ts got so I can alert the users appropriately? Maybe something with try..catch and a certain error id? Thanks alot!
  • baileylo
    New Member
    • Oct 2007
    • 2

    #2
    I'm not quite sure these are the solutions you're looking for but you could try this:
    [PHP]
    if(!file_get_co ntents($filenam e))
    $error[] = "An error has occured locating your file
    [/PHP]

    Comment

    • BaKo
      New Member
      • Sep 2007
      • 11

      #3
      almost, but i needa know which error occured. anyone have an idea?

      Comment

      • Atli
        Recognized Expert Expert
        • Nov 2006
        • 5062

        #4
        Hi.

        Try the error_get_last( ) function.

        Comment

        Working...