Google trends Public Holidays Coupon Code Code Compiler

Get Current Controller Name and Method Name in CodeIgniter


Jul 25, 2020

In this tutorial, I will show you how to get current controller name and method name in Codeigniter. In some cases we need to get current controller name or current method name.

Using the Router Class in CodeIgniter, you can easily get the current controller and method name. The Router class helps to parses URIs and determines routing.


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();

Copyright 2024. All rights are reserved