2013-10-16 36 views

回答

3

我不知道你正在使用的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

+0

謝謝你,工作完美 – Elmasry

1

如果您使用Laravel 4,你需要使用withInput代替with_input

+0

是的,非常感謝 – Elmasry

+0

救了我的一天,謝謝! – Allman