PHP Класс yii\web\HttpException

HttpException can be differentiated via its [[statusCode]] property value which keeps a standard HTTP status code (e.g. 404, 500). Error handlers may use this status code to decide how to format the error page. Throwing an HttpException like in the following example will result in the 404 page to be displayed. php if ($item === null) { // item does not exist throw new \yii\web\HttpException(404, 'The requested Item could not be found.'); }
С версии: 2.0
Автор: Qiang Xue ([email protected])
Наследование: extends yii\base\UserException
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$statusCode HTTP status code, such as 403, 404, 500, etc.

Открытые методы

Метод Описание
__construct ( integer $status, string $message = null, integer $code, Exception $previous = null ) Constructor.
getName ( ) : string

Описание методов

__construct() публичный Метод

Constructor.
public __construct ( integer $status, string $message = null, integer $code, Exception $previous = null )
$status integer HTTP status code, such as 404, 500, etc.
$message string error message
$code integer error code
$previous Exception The previous exception used for the exception chaining.

getName() публичный Метод

public getName ( ) : string
Результат string the user-friendly name of this exception

Описание свойств

$statusCode публичное свойство

HTTP status code, such as 403, 404, 500, etc.
public $statusCode