September 9, 2018
How to Get Current Controller and Method Name in CodeIgniter
How to Get Current Controller and Method Name in CodeIgniter
In this tutorial,we see how to get current controller and method name in Codeigniter application.
In some cases we need to get current controller name or current method name.
It can do it simply by using $this->route variable of codeigniter.
Fetch Current Class Name In Codeigniter
Use fetch_class() method to get the name of the controller or class in CodeIgniter.
$this->router->fetch_class();
Fetch Current Method Name In Codeigniter
Use fetch_method() method to get the name of the method or function in CodeIgniter.
$this->router->fetch_method();