Using the Router Class in CodeIgniter, you can easily get the current controller and method name. Sometime you need to do conditional based code. Then you need a class name and method name.
Using fetch_class() method, you can get the current class or controller name.
$this->router->fetch_class();
Using fetch_method() method, you can get the current method name.
$this->router->fetch_method();
Question and answer is powered by AnsPress.io