How to Get Current URL with Query String in Codeigniter?
If you require to get current URL with parameters in your codeigniter project then you can get easily using "url" helper. Codeigniter provide url helper library that way we can get existing page url or base url etc. you can also get only parameters without URL using "input" as like bellow.
$parameters = $this->input->get();
But, we are getting full path using "url" helper and $_SERVER variable. So, you can see how to get full path using both as bellow:
Example:
$this->load->helper('url');
$currentURL = current_url();
$params = $_SERVER['QUERY_STRING'];
$fullURL = $currentURL . '?' . $params;
print_r($fullURL);
I hope it can help you...
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- Codeigniter Curl Post Request with Parameters Example
- How to Get Current Month Records in Codeigniter?
- Codeigniter Form Validation with Error Message
- Codeigniter Add/Remove Multiple Input Fields Dynamically using JQuery
- How to Get form Post Data in Controller Codeigniter?
- How to Get All Tables List in Codeigniter?
- Codeigniter Implement Fullcalendar Example Tutorial
- Codeigniter Ajax Pagination using JQuery Example
- Codeigniter Resize Image and Create Thumbnail Example
- Codeigniter Select2 Ajax Autocomplete from Database Example
- How to Get Current URL in Codeigniter?
- How to Get Current URL in Laravel?
- How to Get IP Address in Codeigniter?
- Codeigniter 3 and AngularJS CRUD with Search and Pagination Example.