0 追蹤者

Class yii\web\ServerErrorHttpException

繼承yii\web\ServerErrorHttpException » yii\web\HttpException » yii\base\UserException » yii\base\Exception » Exception
自版本起可用2.0
原始碼 https://github.com/yiisoft/yii2/blob/master/framework/web/ServerErrorHttpException.php

ServerErrorHttpException 代表一個 "內部伺服器錯誤" HTTP 異常,狀態碼為 500。

參見 https://tools.ietf.org/html/rfc7231#section-6.6.1

公開屬性

隱藏繼承屬性

屬性 類型 描述 定義於
$statusCode integer HTTP 狀態碼,例如 403、404、500 等。 yii\web\HttpException

方法詳情

隱藏繼承方法

__construct() public method

建構子。

public void __construct ( $message null, $code 0, $previous null )
$message string|null

錯誤訊息

$code integer

錯誤代碼

$previous Throwable|null

用於異常鏈結的前一個異常。

                public function __construct($message = null, $code = 0, $previous = null)
{
    parent::__construct(500, $message, $code, $previous);
}

            
getName() public method
public string getName ( )
return string

此異常的使用者友善名稱

                public function getName()
{
    if (isset(Response::$httpStatuses[$this->statusCode])) {
        return Response::$httpStatuses[$this->statusCode];
    }
    return 'Error';
}