ValidationMessage.php 484 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace UCore\Validator;
  3. use UCore\Exception\ValidateException;
  4. trait ValidationMessage
  5. {
  6. /**
  7. * 抛出验证错误的异常
  8. * @param $value
  9. * @param string $message 消息模版
  10. * @param string $msg
  11. * @return mixed
  12. * @throws ValidateException
  13. */
  14. public function throwMessage($p, $msgTpl)
  15. {
  16. // dd(strtr($msgTpl, $p),$msgTpl,$p);
  17. throw new ValidateException($this->validation, strtr($msgTpl, $p));
  18. }
  19. }