ValidateException.php 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: yunwuxin <448901948@qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace think\exception;
  12. class ValidateException extends \RuntimeException
  13. {
  14. protected $error;
  15. public function __construct($error)
  16. {
  17. $this->error = $error;
  18. $this->message = is_array($error) ? implode("\n\r", $error) : $error;
  19. }
  20. /**
  21. * 获取验证错误信息
  22. * @access public
  23. * @return array|string
  24. */
  25. public function getError()
  26. {
  27. return $this->error;
  28. }
  29. }