我正在使用Laravel 4,
我正在用验证器验证一个表单:
$validator = Validator::make(Input::all(), $rules);
失败时:
if ($validator->fails()) {
return Redirect::to('register/test')
->withErrors($validator)
->withInput(Input::except('password')); // send back the input so that we can repopulate the form
}
如何返回除多个输入之外的输入,而不仅仅是密码?
我试过Input::except('password','avatar');
,但它不工作。
任何帮助都将非常感激!
实际上,我发现我忘记把Input::old('')
重新填充输入,
所以解决方案正是我所尝试的Input::except('password','avatar');
Try
Input::except(array('password', 'avatar'));