F
F
furyon2015-12-21 07:30:57
PHP
furyon, 2015-12-21 07:30:57

How to handle PHP error?

Hello!
The task is this, if a PHP error suddenly crashes, you need to call the command (for example, to the console).
Are there any options other than error_exception, and based on practice, how convenient is it to work with error_exception?
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2015-12-21
@kasus

You need to wrap the code that throws an error in a try .. catch block:

try {
  // Исполняемый код, который вызывает ошибку
} catch (Exception $e) {
  // Здесь код, который вызывается при возникновении ошибки
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question