Today now in this post i will show you How to get current url in controller or view in Codeigniter?Sometimes, we may need to get the current URL path in our controller file or any view file. So, we can get simply by using “url” helper. Codeigniter is provide us url helper library on that way we can get the existing page url or base url etc.
By using current_url() through we can get the current url in our Codeigniter application. But, we should load the “url” helper before use the current_url(). we can load the url helper as like as bellow:
Now in the bellow example, we can see code how we can get the current url in our controller file.
So, let’s see.
this->load->helper('url'); $currentURL = current_url(); print_r($currentURL);
Read Also : Laravel 8 Mobile Number Verification Tutorial
Thanks for read. I hope it help you. For more you can follow us on facebook.