Get routing working in sub-directories.

This commit is contained in:
Lonnie Ezell 2015-11-27 23:25:41 -06:00
parent 1f275847dd
commit 5b62fad76c
2 changed files with 6 additions and 1 deletions

View File

@ -141,6 +141,11 @@ else
}
else
{
if (! class_exists($controller))
{
require APPPATH.'controllers/'.$router->directory().$router->controllerName().'.php';
}
$class = new $controller($request, $response);
$method = $router->methodName();
$class->$method(...$router->params());

View File

@ -249,7 +249,7 @@ class Router implements RouterInterface
}
// If not empty, then the first segment should be the controller
$this->controller = $segments[0];
$this->controller = ucfirst($segments[0]);
// Use the method name if it exists.
// If it doesn't, no biggie - the default method name