URI 细分

例如,请考虑以下 URI:

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

Segment 允许检索特定的段表单 URI 字符串,其中 n 是段号。细分从左到右编号。例如,以下代码:

$this->uri->segment(n)

用于从 URI 中检索特定段,其中 n 是段号。

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