使用laravel传递URL中的值

时间:2017-03-23 11:54:26

标签: laravel laravel-5

有没有办法改变这个网址

http://example.com/search?values[]=foo&values[]=bar&more[]=baz&more[]=fab

什么东西更友好?

http://example.com/search/values/<mutliple-items>/more/<mutliple-items>

2 个答案:

答案 0 :(得分:0)

试试这个:

Route::get('search/values/{mutliple_items1}/more/{mutliple_it‌​ems2}', 'SearchController@search');

答案 1 :(得分:0)

答案由@alexslipknot提供

Route::get('search/values/{slashValues?}/more/{slashMore?}', 'Website\SearchController@searchTest')
    ->where('slashValues', '(.*)')
    ->where('slashMore', '(.*)');

它完美无缺