首先开启多应用的方法:
composer require topthink/think-multi-app
定义路由:
<?php use think\facade\Route; Route::any('/user/login', '\\app\\index\\controller\\User@login');
打印控制器和方法名:
dd($this->request);
但是发现这个属性是可以用的:
解决方式:
$routeName = $this->request->rule()->getName(); $routeName = explode('@', $routeName); $controllerName = $routeName[0]; $actionName = $routeName[1]; dump($controllerName, $actionName);标签:actionName,控制器,request,thinkPHP6.0,空值,routeName,controllerName From: https://www.cnblogs.com/felixwan/p/16948909.html