1
有没有使用Kohana(3+)验证类而不使用消息文件的方法?没有消息文件的Kohana验证
[编辑]
下面是一个例子:
$post = Validate::factory($_POST);
$post
->rule('username', 'not_empty')
->rule('username', 'regex', array('/^[a-z_.]++$/iD'))
->rule('password', 'not_empty')
->rule('password', 'min_length', array('6'))
->rule('confirm', 'matches', array('password'))
->rule('use_ssl', 'not_empty');
错误消息将从消息文件被readed,但我想硬编码在源代码中的错误消息。例如:
$post->rules->('username', 'not_empty', 'Please give your username');
你能澄清你的意思吗?“不使用消息文件”?你想从其他来源设置验证错误消息吗? – Dickie
您将在代码中导致问题。 –
@ ThePixelDeveloper如果我在代码中硬编码错误消息,或者您是否想要其他东西,会导致问题? –