Understanding routes |
Hello, i'm new in CI and i just started my app.My question is about routes, if i have :
PHP Code: $route['something/(:any)'] = 'Login/test/$1'; And if i request 'something' without anything, i must to make another route like this : $route['something'] = 'Login/test'; and finally to look like this: PHP Code: $route['something'] = 'Login/test/$1'; [font=Monaco, Consolas, Courier, monospace]Or is another way to make this?[/font] [font=Monaco, Consolas, Courier, monospace]My controller is:[/font] PHP Code: class Login extends CI_Controller{
Hello,
I think that this is a CI3 question posted in the CI4 section :-) If you are talking about CI4, you can use " $routes->resource('something'); ". It will create all routes for you and solve your problem: https://codeigniter4.github.io/userguide...stful.html Anyway, the "app/Config/Routes.php" file says: // We get a performance increase by specifying the default // route since we don't have to scan directories. So I prefer to define all routes manually. I don't know if this is the right reasoning to have though :-) |
Welcome Guest, Not a member yet? Register Sign In |