Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

35 lines
1.1KB

  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\web;
  8. /**
  9. * UnauthorizedHttpException represents an "Unauthorized" HTTP exception with status code 401
  10. *
  11. * Use this exception to indicate that a client needs to authenticate or login
  12. * to perform the requested action. If the client is already authenticated and
  13. * is simply not allowed to perform the action, consider using a 403
  14. * [[ForbiddenHttpException]] or 404 [[NotFoundHttpException]] instead.
  15. *
  16. * @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2
  17. * @author Dan Schmidt <danschmidt5189@gmail.com>
  18. * @since 2.0
  19. */
  20. class UnauthorizedHttpException extends HttpException
  21. {
  22. /**
  23. * Constructor.
  24. * @param string $message error message
  25. * @param integer $code error code
  26. * @param \Exception $previous The previous exception used for the exception chaining.
  27. */
  28. public function __construct($message = null, $code = 0, \Exception $previous = null)
  29. {
  30. parent::__construct(401, $message, $code, $previous);
  31. }
  32. }