多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
1、获取当前的控制器(带Controller) ``` function getController(){ $str = request()->route()->getActionName(); $num = strripos($str,"\\") + 1; $str2 = substr($str,$num); $num2 = strpos($str2,'@'); $controller = substr($str2,0,$num2); return $controller; } ``` ![](https://img.kancloud.cn/3c/e8/3ce8960c208cf455cac2dcab825b3cb8_767x190.png) 2、获取当前的控制器(不带Controller) ``` function getController(){ $str = request()->route()->getActionName(); $num = strripos($str,"\\") + 1; $str2 = substr($str,$num); $num2 = strpos($str2,'@'); $controller = substr($str2,0,$num2 - 10); return $controller; } ``` ![](https://img.kancloud.cn/7c/80/7c80aa6f70d81af7b84dd5793adc8597_670x166.png) 3、获取当前方法名 ``` request()->route()->getActionMethod(); ``` ![](https://img.kancloud.cn/16/9d/169d7f1e24f85ee77b5d26183ec17ba3_777x184.png) 4、获取当前地址 ``` request()->url(); ``` ![](https://img.kancloud.cn/ea/85/ea85df389c51309e64e18a7dae8d65e0_641x175.png) 5、获取当前路由 ``` request()->path(); ``` ![](https://img.kancloud.cn/52/bf/52bf702572e4dc03a7bd5db57beeb02f_632x161.png)