search

Home  >  Q&A  >  body text

php - How to get current controller (and method) information starting from laravel 5.2?

Print dd(\Route::currentRouteAction(), \Route::current()); The result is null, null.

How to get the current controller (and method) information starting from laravel 5.2?

Remarks: When dingo is used, routing is taken over by dingo's DingoApiRoutingRouter

巴扎黑巴扎黑2788 days ago930

reply all(4)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-06-24 09:44:30

    echo Route::getCurrentRoute()->getActionName();

    reply
    0
  • PHP中文网

    PHP中文网2017-06-24 09:44:30

    dd(Route::currentRouteAction()); //dingo router里面有定义这个方法

    输出 "AppHttpControllersApiUserController@index"

    reply
    0
  • PHP中文网

    PHP中文网2017-06-24 09:44:30

    Use dd(request()->route()->getAction());

    reply
    0
  • 天蓬老师

    天蓬老师2017-06-24 09:44:30

    dd(explode(__METHOD__));

    reply
    0
  • Cancelreply