Getting GET “?” variable in laravel

前端 未结 8 810
夕颜
夕颜 2020-12-16 08:41

Hello I\'m creating API using REST and Laravel following this article.

Everything works well as expected.

Now, I want to map GET request to recognise variabl

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-16 09:42

    Take a look at the $_GET and $_REQUEST superglobals. Something like the following would work for your example:

    $start = $_GET['start'];
    $limit = $_GET['limit'];
    

    EDIT

    According to this post in the laravel forums, you need to use Input::get(), e.g.,

    $start = Input::get('start');
    $limit = Input::get('limit');
    

    See also: http://laravel.com/docs/input#input

提交回复
热议问题