How to get the current URL in Codeigniter?

How to get the current URL in Codeigniter?

In this article, we will explain to you how to get the current URL in Codeigniter. we can easily retrieve the current Url using the Codeigniter helper URL. so first we have to load the helper URL after then we can fetch the URL.

Codeigniter is the most powerful framework of PHP. it provides a URL Helper library. we need to just load that library after loading the library we can easily get the Url. Codeigniter helper Url provide many types of function such as site_url(), base_url(), current_url(), uri_string(), index_page(), anchor() and etc. you can also read or visit on official guideline. so you can see below the following example.

Get current URL in codeigniter

sometimes we need to get the current URL in the controller. Codeigniter provides the inbuilt library. so we can easily get the current URL using the current_url() method.

how to get URL segment in codeigniter

sometimes we need to get the Segments URL in the controller. Codeigniter provides the inbuilt library. so we can easily get the Segments URL using the segment() method.

Get current controller name in codeigniter

sometimes we need to get the current controller name in the Codeigniter. Codeigniter provides the inbuilt library. so we can easily get the current controller name using the fetch_class() method.

Get Current Controller Method Name in codeigniter

sometimes we need to get the current controller method’s name in the Codeigniter. Codeigniter provides the inbuilt library. so we can easily get the current controller method’s name using the fetch_method() method.

Read Also
Setup HMVC With Codeigniter 3
Codeigniter Last Query Print Example
How To Create Dynamic Xml Sitemap In Codeigniter
How To Install Codeigniter In Xampp Server

Please follow and like us: