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如果我在代碼中硬編碼錯誤消息,或者您是否想要其他東西,會導致問題? –