How do I catch notice, warning errors in php?

Notice: Undefined property: stdClass::$xxx in /Applications/xxx/xxx/xxx/xxx.php on line 35

Warning: Invalid argument supplied for foreach() in /Applications/xxx/xxx/xxx/xxx.php on line 35

how can I avoid errors like this in the above
?
if I can, I"d like to change it to my own solution
I won"t blame you for seeing it.


users see?
in general, in production systems, the display_errors in php.ini is set to off, so that as long as the user page can be rendered, there will be no error message at the front-end level. When developing, you can write:

at the beginning of the file
  

set_error_handler , set_exception_handler , register_shutdown_function these three methods, you can find various frameworks to see their error exception takeover, or you can use a ready-made class library like whoops.

Menu