Today now in this post i will show you How to get current url with query string in codeigniter? Sometimes we may need to get the current URL with parameters in our codeigniter project. Then we can get easily get this by using “url” helper. We know Codeigniter is provide us url helper library on that way we can get the existing page url or base url etc. We can also get only the parameters without URL by using “input” as like bellow.
$parameters = $this->input->get();
But, we are getting the full path by using “url” helper and $_SERVER variable. So, we can see here how to get the full path by using both as like as bellow:
$this->load->helper('url'); $currentURL = current_url(); $params = $_SERVER['QUERY_STRING']; $fullURL = $currentURL . '?' . $params; print_r($fullURL);
Thanks for read. I hope it help you. For more you can follow us on facebook