CI 3.0 default route is placed in a subfolder and is inaccessible.

巴扎黑
Release: 2023-03-11 06:04:01
Original
1369 people have browsed it
This article is reproduced from:
##For example, if you want to configure the default route as: $route['default_controller'] = 'index/home';

Before ci3.0, it could be placed in a subfolder in controllers in, but when it comes to ci3.0, it must be placed directly under controllers. If you insist on placing it under its subfolder, the solution is as follows:

Find system > core > router.PHP 2978 Comment out line -301. (Mine is version 3.1.3) as follows:

  1. // if (sscanf($this->default_controller, '%[^/]/%s', $class, $method) !== 2)

  2. // {

  3. ##                                                                              #// }
  4. Then add the following code at the end:

$index =
strripos(
$this->default_controller,

'/');

// Record the subscript of the symbol '/'
  1. ($index == false) ##                                                                       $this->default_controller;

    // Without '/' you can assign the value directly
  2. # }else{

  3.               
  4. $this->directory =
  5. substr(

    $this->default_controller, 0, $index + 1); //Directory string

  6. #                                                       ->default_controller, $index + 1); //Class string

  7. ## }   ##                                                                                         ​ 

  8. #This solves the problem that the default route cannot be found in a subfolder.

The above is the detailed content of CI 3.0 default route is placed in a subfolder and is inaccessible.. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template