Skip to content

custom error message

Inhere edited this page Feb 12, 2019 · 1 revision

自定义错误消息

规则中设置 msg

设置当前规则的错误提示消息, 设置了后就不会在使用默认的提示消息。

['title', 'customValidator', 'msg' => '{attr} error msg!' ], // 指定当前规则的消息
// o, 可以是数组哦 :)
['tagId, title, userId, freeTime', 'required', 'msg' => [
  'tagId' => 'message ...',
  'userId' => 'message 1 ...',
]],