Is there a @ default for set_error_handler error truncation?

clipboard.png

some errors are

Undefined index: password
The

category is like this
. I have added @ not to report
, but it will still be available on set_error_handler.
can you skip the @?


errors are meaningful.

for example, this Undefined index . In 80% of the cases, if a parameter is not passed in, it is not in the $_ GET or the corresponding array. Of course, if you quote something that does not exist in the array, you will report an error. But you can't turn it off just because you don't want to see it, so when you want to debug, open error.log , clean, and all the places that should have problems have been destroyed by @ . What should I do? Then we can only go around a bigger bend.

back to this question. In fact, the solution is very simple. For example, if you want to take a $GET ['id'] , you can judge first. Since it is an array, then there must be a way to detect whether the key name exists, or there is a fixed way to write it, or there must be a method for API,. Then in PHP, you can use the array_key_exists method to make a judgment first. If there is a value, I wish I didn't throw it an empty string or some other logo. For example:

$userid = array_key_exists('id', $_GET) ? $_GET['id'] : '';
Menu