因为ThinkPHP5.1的手册上没找到也不知道是不是没写,在网上送到了记一下。
首先,命名空间导入 Request 类
use think\facade\Request;
然后再你需要的地方使用下列办法获取 模块、控制器、操作的名字即可
$moduleName = Request::module();
$controllerName = Request::controller
因为ThinkPHP5.1的手册上没找到也不知道是不是没写,在网上送到了记一下。
首先,命名空间导入 Request 类
use think\facade\Request;
然后再你需要的地方使用下列办法获取 模块、控制器、操作的名字即可
$moduleName = Request::module();
$controllerName = Request::controller