Php laravel 4从路由获取控制器方法
如果我有一条简单的路线Php laravel 4从路由获取控制器方法,php,laravel,laravel-4,laravel-routing,Php,Laravel,Laravel 4,Laravel Routing,如果我有一条简单的路线 Route::get('foo', 'path\to\controller\MyController@bar'); 当我在应用程序中时,是否有一个方法/函数将返回所使用的控制器方法?ie:酒吧 。。。。是否有类似\Route::getCurrentControllerMethod的方法尝试以下方法之一: Route::getCurrentRoute()->getAction(); Route::currentRouteAction(); Route::curren
Route::get('foo', 'path\to\controller\MyController@bar');
当我在应用程序中时,是否有一个方法/函数将返回所使用的控制器方法?ie:酒吧
。。。。是否有类似\Route::getCurrentControllerMethod的方法尝试以下方法之一:
Route::getCurrentRoute()->getAction();
Route::currentRouteAction();
Route::currentRouteName();
如果您只想从当前路线获取酒吧,则应使用:
$method = explode('@', Route::currentRouteAction());
$method = end ($method);