第一个办法
地址 : index.php/url/index/3
<?php
class Url extends CI_Controller
{
public function index()
{
echo $this->uri->segment(1); //url
echo $this->uri->segment(2); //index
echo $this->uri->segment(3); //3
}
}
?>
注意是 uri 不是 url
第二个办法
<?php
class Url extends CI_Controller
{
public function index($id)
{
echo $id; //3
}
}
?>