2015-02-09 50 views

回答

0

你可以得到所有的参数,然后使用索引:

$parameters = array_values(Route::current()->parameters()); 

echo $parameters[0]; 
echo $parameters[1]; 

(需要array_values否则$parameters是一个关联键值数组)

或者,如果你知道路线的实际名称你可以简单地使用参数Route::input()

echo Route::input('first'); 
echo Route::input('second'); 
0

http://laravel.com/api/4.2/Illuminate/Http/Request.html

有关于在L4.2文档的Request类没有route()方法。

然而有Route::getCurrentRoute()->getParameters()这可能能够做你想做的。

+0

是的,但route()得到不同的参数,route :: currentRouteName()如何关联t那? – user3150060 2015-02-09 21:07:15

+0

编辑,粘贴错误的代码片段。在这里看到更多:https://github.com/laravel/framework/issues/2919 – 2015-02-09 21:09:36