简体   繁体   中英

How to pass Multiple Parameters through URL to Controller using Input::get('paramter1') in Laravel 5.2?

This is my route.php

Route::get('test/{paramter1}/{paramter2}', 'Somecontroller@somemethod');

In Somecontroller.php , I want these parameter like

$val_1 = Input::get('paramter1'); $val_2 = Input::get('paramter2');

and then $val_1 , $val_2 are passed to database.

How can I do that?

I have tried using the same. but it's not working.

Thank You in Advance.

You just have them as arguments for the someMethod.

public function someMethod(Request $request, $paramter1, $paramter2)
{
    // Your code here...
}

Laravel will do the rest. It's detailed in the Laravel documentation under Controllers .

Try this below.

Route::get('{x}/{y}', 'PagesController@index');

public function index($x, $y)
{


}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM