use Hyperf\HttpServer\Router\Dispatched;
$controllerMethod = explode('@',$this->request->getAttribute(Dispatched::class)->handler->callback);
var_dump($controllerMethod)
// array(2) {
// [0]=>
// string(43) "\App\Controller\IndexController"
// [1]=>
// string(3) "index"
// }
$controlle = $controllerMethod[0];
$method = $controllerMethod[1];
hyperf 获取当前路由请求的控制器和方法名
最新推荐文章于 2023-07-01 15:40:42 发布