在 Codeigniter 3 中,可以使用以下代码获取当前事件的类和方法:
$active_controller = $this->router->fetch_class();
$active_function = $this->router->fetch_method();
Codeigniter 4 中有这样的函数吗?
最佳答案
在 CodeIgniter 4 中
$router = service('router');
$controller = $router->controllerName();
$router = service('router');
$method = $router->methodName();
关于Codeigniter 4 电流/有源 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56912581/