Difficulty with two Uri segments

Asked

Viewed 64 times

0

They are trying to create the url, where the first segment is the user and the second is his file, e.g.: http://www.exemplo.com/joao/bola

Controller

public function user() {

    $user_url = $this->uri->segment(1);

}

^ This would return the profile with all the files: http://www.exemplo.com/joao

public function arquivo() {

    $arquivo_url = $this->uri->segment(2);

}

^ That the specific file: http://www.exemplo.com/joao/bola

Routes

$route['(:any)'] = 'home/user/$1';
$route['??'] = 'home/arquivo/$1';

1 answer

1


Already getting the solution would be something like

$route['([^/]+)'] = 'home/user/$1';
$route['(:any)/(:any)'] = 'home/arquivo/$1';

Browser other questions tagged

You are not signed in. Login or sign up in order to post.