Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php laravel 4从路由获取控制器方法_Php_Laravel_Laravel 4_Laravel Routing - Fatal编程技术网

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);