Skip to content Skip to sidebar Skip to footer

CodeIgniter get URL parameters

Reading Time: < 1 minute

How to fetch url parameters in the codeigniter.This is very simple.All data get as an array.
Example
http://www.mysite.com/index.php/deposit/11/3
index.php => 0
deposit => 1
11 => 2
3 => 3
Here is a method to get parameters.
First of all you have to load url helper, like this.

$this->load->helper('url');

 
Then,

$portid = $this->uri->segment(2);  // get 11
$portid = $this->uri->segment(3);  // get 3

That’s all.