codeigniter CodeIgniter URI Segment URI Segments:

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9

Example

For example, please consider the following URI:

http://stackoverflow.com/questions/some-number/how-can-i-do-this/others

Segment allows to retrieve a specific segment form URI string where n is a segment number. Segments are numbered from left to right. For example, the following code:

$this->uri->segment(n)

Is used to retrieve a specific segment from the URI where n is the segment number.

echo $this->uri->segment(0);//it will print stackoverflow.com
echo $this->uri->segment(1);//it will print questions
echo $this->uri->segment(2);//it will print some-number
echo $this->uri->segment(3);//it will print how-can-i-do-this
echo $this->uri->segment(4);//it will print others


Got any codeigniter Question?