Home  >  Article  >  PHP Framework  >  yii2 close error prompt

yii2 close error prompt

angryTom
angryTomOriginal
2019-11-06 16:45:213824browse

yii2 close error prompt

yii2 Close error prompt

In using Yii2, we found that once an error occurs in the program, Yii2 can Automatically displays its dedicated error prompt interface, which is completely different from the error prompt interface that appeared when we wrote the original ecology.

In fact, PHP has its own dedicated error handling API. When a problem occurs in the program, the specified function can be automatically called. Yii2 takes advantage of this. When it starts, it uses PHP's built-in set_error_handler to register its own error processing and turn off PHP's own error display.

Yii2 error registration mechanism

The following variables will control whether to enable error processing. The default is on. You can turn off the error log by setting the variable value

# \yii\BaseYii.php
/**
 * This constant defines whether error handling should be enabled. Defaults to true.
 */
 defined('YII_ENABLE_ERROR_HANDLER') or define('YII_ENABLE_ERROR_HANDLER', true);

Recommended: "YII Tutorial"

The above is the detailed content of yii2 close error prompt. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn