如何在 Laravel 中将多个变量从视图传递到控制器?

How to pass multiple variables from view to controller in Laravel?

我想将表单数据从视图传递到控制器内的函数。有哪些方法可以做到?

就是这样:

查看:

{ Form::open(array('action' => 'Controller@method')) }}
    {{ Form::text('rate', '', array('placeholder' => 'Enter new custom client rate...')) }}
    {{ Form::submit('Submit', array('class' => 'btn btn-primary')) }}
{{ Form::close() }}

在你的控制器中:

class Controller extends BaseController {
   public function method()
   {
       // get the rate value
       $rate = Input::get('rate');

       or

       // to get all form values
       $allFormValues = Input::all();

   }
}

就是这样。

Laravel 足够聪明,可以获取所有这些请求值。