This article goes from:
-
Let's say you want to configure the default route to: $route [' default_controller '] = ' index/home ';
ci3.0 before can be placed in the Controllers subfolder, but to the ci3.0 must be placed directly under the controllers, if you persist in its sub-folder, the solution is as follows:
Locate System > Core > Router. Comment out the PHP 2978-301 line. (My version of 3.1.3) is as follows:
-
if (sscanf ($this->default_controller, '%[^/]/%s ', $class, $method)!== 2)
-
// {
-
//$method = ' index ';
-
// }
Then add the following code:
-
$index = Strripos ($this->default_controller, '/'); //The subscript of the record symbol '/'
-
if ($index = = False)
-
{
-
$class = $this->default_controller; //No '/' can be directly assigned
-
}else{
-
$this->directory = substr ($this->default_controller, 0, $index + 1); //directory string
-
$class = substr ($this->default_controller, $index + 1); //String of class
-
}
-
$method = $this->method; //default method
This solves the problem that the default route cannot be found under sub-folders.