没有命名空间的类 yii yii\base yii\behaviors yii\caching yii\captcha yii\console yii\console\controllers yii\console\widgets yii\data yii\db yii\db\conditions yii\db\cubrid yii\db\cubrid\conditions yii\db\mssql yii\db\mssql\conditions yii\db\mysql yii\db\oci yii\db\oci\conditions yii\db\pgsql yii\db\sqlite yii\db\sqlite\conditions yii\di yii\filters yii\filters\auth yii\grid yii\helpers yii\i18n yii\log yii\mail yii\mutex yii\rbac yii\rest yii\test yii\validators yii\web yii\widgets

Class yii\console\ErrorHandler

继承yii\console\ErrorHandler » yii\base\ErrorHandler » yii\base\Component » yii\base\BaseObject
实现yii\base\Configurable
可用版本自2.0
源码 https://github.com/yiichina/yii2/blob/api/framework/console/ErrorHandler.php

ErrorHandler 处理未捕获的 PHP 错误和异常。

ErrorHandler 在 yii\base\Application 中默认被配置为饮用程序组建。 你可以通过 Yii::$app->errorHandler 访问该实例。

公共属性

隐藏继承的属性

属性类型描述被定义在
$behaviors yii\base\Behavior[] List of behaviors attached to this component yii\base\Component
$discardExistingOutput boolean 是否在错误显示之前丢弃任何现有页面输出。默认为 true。 yii\base\ErrorHandler
$exception Exception|null 当前正在处理的异常。 yii\base\ErrorHandler
$memoryReserveSize integer The size of the reserved memory. yii\base\ErrorHandler

公共方法

隐藏继承的方法

方法描述被定义在
__call() Calls the named method which is not a class method. yii\base\Component
__clone() This method is called after the object is created by cloning an existing one. yii\base\Component
__construct() Constructor. yii\base\BaseObject
__get() Returns the value of a component property. yii\base\Component
__isset() Checks if a property is set, i.e. defined and not null. yii\base\Component
__set() Sets the value of a component property. yii\base\Component
__unset() Sets a component property to be null. yii\base\Component
attachBehavior() Attaches a behavior to this component. yii\base\Component
attachBehaviors() Attaches a list of behaviors to the component. yii\base\Component
behaviors() Returns a list of behaviors that this component should behave as. yii\base\Component
canGetProperty() Returns a value indicating whether a property can be read. yii\base\Component
canSetProperty() Returns a value indicating whether a property can be set. yii\base\Component
className() Returns the fully qualified name of this class. yii\base\BaseObject
clearOutput() 在调用此方法之前删除所有回显的输出。 yii\base\ErrorHandler
convertExceptionToError() 将异常转换为 PHP 错误。 yii\base\ErrorHandler
convertExceptionToString() 将异常转换为简单字符串。 yii\base\ErrorHandler
convertExceptionToVerboseString() 将异常转换为具有关于异常及其跟踪的详细信息的字符串。 yii\base\ErrorHandler
detachBehavior() Detaches a behavior from the component. yii\base\Component
detachBehaviors() Detaches all behaviors from the component. yii\base\Component
ensureBehaviors() Makes sure that the behaviors declared in behaviors() are attached to this component. yii\base\Component
getBehavior() Returns the named behavior object. yii\base\Component
getBehaviors() Returns all behaviors attached to this component. yii\base\Component
handleError() Handles PHP execution errors such as warnings and notices. yii\base\ErrorHandler
handleException() 处理未捕获的 PHP 异常。 yii\base\ErrorHandler
handleFatalError() Handles fatal PHP errors. yii\base\ErrorHandler
handleHhvmError() Handles HHVM execution errors such as warnings and notices. yii\base\ErrorHandler
hasEventHandlers() Returns a value indicating whether there is any handler attached to the named event. yii\base\Component
hasMethod() Returns a value indicating whether a method is defined. yii\base\Component
hasProperty() Returns a value indicating whether a property is defined for this component. yii\base\Component
init() Initializes the object. yii\base\BaseObject
logException() Logs the given exception. yii\base\ErrorHandler
off() Detaches an existing event handler from this component. yii\base\Component
on() Attaches an event handler to an event. yii\base\Component
register() 注册此错误处理程序。 yii\base\ErrorHandler
trigger() Triggers an event. yii\base\Component
unregister() 通过还原 PHP 错误和异常处理程序取消注册此错误处理程序。 yii\base\ErrorHandler

受保护的方法

隐藏继承的方法

方法描述被定义在
formatMessage() 对控制台输出的消息进行着色处理。 yii\console\ErrorHandler
handleFallbackExceptionMessage() Handles exception thrown during exception processing in handleException(). yii\base\ErrorHandler
renderException() 使用 ansi 格式为控制台输出呈现异常。 yii\console\ErrorHandler

方法详情

formatMessage() 受保护 方法

对控制台输出的消息进行着色处理。

参见 yii\helpers\Console::ansiFormat() 有关如何指定消息格式的详细信息。.

protected string formatMessage($message, $format = [\yii\helpers\Console::FG_RED, \yii\helpers\Console::BOLD])
$message string

要着色的信息。

$format array

消息格式。

return string

彩色信息。

renderException() 受保护 方法

使用 ansi 格式为控制台输出呈现异常。

protected void renderException($exception)
$exception Exception

要呈现的异常。