[英]Laravel Routes: Use ::controllers and ::post
Within Laravel, I currently have: 在Laravel中,我目前有:
Route::controllers([
'bla' => 'BlaController',
]);
But for a few specific methods within BlaController, I would like to pass parameters via the route (eg: /bla/parameter
) and then be able to access that parameter within the controller. 但是对于BlaController中的一些特定方法,我想通过路由传递参数(例如:
/bla/parameter
),然后能够在控制器中访问该参数。
However, declaring: 但是,声明:
Route::get('bla/{parameter}', 'BlaController@exampleMethod');
keeps giving me a 404 not found when visiting it. 不断给我一个404时找不到的404。
Is there some kind of conflict between using both declarations within routes.php
and if so, is there a way to pass parameters to the controller for specific methods? 在
routes.php
使用两个声明之间是否存在某种冲突,如果可以,是否存在将参数传递给特定方法的控制器的方法?
Edit : This is Laravel 5.1, if that makes any difference! 编辑 :这是Laravel 5.1,如果有什么不同!
Can u try this ? 你可以试试吗?
Route::get('/bla/{parameter}' ['uses'=>'BlaController@exampleMethod']);
http://laravel.io/forum/07-26-2014-routing-passing-parameters-to-controller http://laravel.io/forum/07-26-2014-routing-passing-parameters-to-controller
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.