include file, file not found

Asked

Viewed 27 times

0

When making use of include() or include_once(), and by some misfortune the file is not found, so it is revealed the missing file name and directory structure.

In the php documentation itself there is no reference to treat information when the declared file is not found, what I have done is to make use of @ before the include to hide the message but do not know if this is correct or some kind of "gambiarra", someone has some information about it that can share?

EDITED:

Searching deeper I found the reference to "Error Control Operators" that took away my doubt, is the link to be useful to interested.

https://www.php.net/manual/en/language.operators.errorcontrol.php

  • It is up to the error handler to give some meaning in the different levels of error. You can make your custom error handler echo all errors even if the bug report is set to NONE.

  • then what does the @ operator do? Temporarily sets the error reporting level to 0 for that line. If this line triggers an error, the error handler will still be called, but will be called with an error level of 0

  • 1

    And always remember to look at the PHP (or apache) error log. Many of the errors that are not displayed on the screen still appear there. I updated the links

  • I read with patience and am noticing a new load of knowledge with so much content rich in detail, I’m in love with all this. Gratitude.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.