我使用with_input()時,請用戶舊的輸入數據的驗證錯誤submiting後收到此錯誤:未定義偏移:0當使用 - > with_input() - laravel
ErrorException 未定義抵消:0
對重定向代碼:
return Redirect::to('login')->with_input();
我使用with_input()時,請用戶舊的輸入數據的驗證錯誤submiting後收到此錯誤:未定義偏移:0當使用 - > with_input() - laravel
ErrorException 未定義抵消:0
對重定向代碼:
return Redirect::to('login')->with_input();
我不知道你正在使用的Laravel的版本,但你的代碼應該是:
return Redirect::to('login')->withInput();
,如果你正在返回的錯誤太多,你可能會考慮除了使用withErrors()
:
Route::post('register', function()
{
$rules = array(...);
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails())
{
return Redirect::to('register')->withErrors($validator);
}
});
檢查文檔: http://laravel.com/docs/validation#error-messages-and-views
謝謝你,工作完美 – Elmasry