[eluser]fanxuan[/eluser]
Glad to be here. I am new to CI.
my routes config is like this :
Code:
$route['user/(:any)/blog/(:num)/'] = "user/blog/$1/$2";
my controller is like this :
Code:
class User extends Controller {
function User()
{
parent::Controller();
$this->load->helper('url');
}
function blog()
{
$user=trim($this->uri->segment(3, 0));
$id = intval($this->uri->segment(4, 0));
echo "user";var_dump($user);
echo "id";var_dump($id);
//$this->load->view('welcome_message');
}
}
Now I wanna direct the url "http://localhost/blog/index.php/user/fanxuan/blog/2222" to "http://localhost/blog/index.php/user/blog/fanxuan/2222" ,but I failed , it prints 404 Error.
Quote:fanxuan is username
2222 is blog id;
Could someone give me some tips how to set the routes to meet my need?
Many many thanks!!