1

这是我从 laravel 应用程序中搜索的视图..

{{ Form::open(array('method' => 'get', 'url' => 'search'))}}
<input type="text" name="location" >
<input type="text" name="query" >
<input type="submit" >
{{ Form::close() }}

当我输入一些东西并按回车时,页面正在带我

然后我的网址是这样的

myapp.com/search?query=abc&location=uk

如何编写路由以获取控制器内的 url 值?请帮助

4

1 回答 1

1

为此,您的路线将是

Route::get('/search',yourController@controllerMethod)

然后转到您定义的类并编写您在路线中提到的方法

public function controllerMethod(){
 dd(Request::all());
}

在请求中,您将获得所有参数数据

于 2016-01-25T06:55:50.720 回答