我的项目结构是
应用 控制器/站点 核心/ 浏览/网站
我希望在输入http://mywebsite
时必须加载管理员,而在输入http://mywebsite/site
时必须加载前端
我经历了一些教程,并在下面做了更改
在config/routes.php
$route['default_controller'] = 'admin';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
$route['site'] = 'site/home';
在core/My_Controller.php
defined('BASEPATH') or exit('No direct script access allowed');
class MY_Controller extends CI_Controller
{
function __construct()
{
parent::__construct();
}
}
class Admin_Controller extends MY_Controller
{
function __construct()
{
parent::__construct();
}
}
class Site_Controller extends MY_Controller
{
function __construct()
{
parent::__construct();
}
}
在controller/site/Home.php
defined('BASEPATH')或exit('不允许直接脚本访问');
class Home extends Site_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{
$this->load->view("site/index.php");
}
}
但是我打开http://mywebsite/site
请帮助我
答案 0 :(得分:0)
0! = 1 no.multi. = 0 sum of 0! = 1 no.multi. = 0
1! = 1 no.multi. = 1 sum of 1! = 2 no.multi. = 1
2! = 2 no.multi. = 2 sum of 2! = 4 no.multi. = 3
3! = 6 no.multi. = 3 sum of 3! = 10 no.multi. = 6
4! = 24 no.multi. = 4 sum of 4! = 34 no.multi. = 10
5! = 120 no.multi. = 5 sum of 5! = 154 no.multi. = 15
6! = 720 no.multi. = 6 sum of 6! = 874 no.multi. = 21
7! = 5040 no.multi. = 7 sum of 7! = 5914 no.multi. = 28
8! = 40320 no.multi. = 8 sum of 8! = 46234 no.multi. = 36
9! = 362880 no.multi. = 9 sum of 9! = 409114 no.multi. = 45
10! = 3628800 no.multi. = 10 sum of 10! = 4037914 no.multi. = 55
11! = 39916800 no.multi. = 11 sum of 11! = 43954714 no.multi. = 66
12! = 479001600 no.multi. = 12 sum of 12! = 522956314 no.multi. = 78
13! = 6227020800 no.multi. = 13 sum of 13! = 6749977114 no.multi. = 91
14! = 87178291200 no.multi. = 14 sum of 14! = 93928268314 no.multi. = 105
15! = 1307674368000 no.multi. = 15 sum of 15! = 1401602636314 no.multi. = 120
16! = 20922789888000 no.multi. = 16 sum of 16! = 22324392524314 no.multi. = 136
17! = 355687428096000 no.multi. = 17 sum of 17! = 378011820620314 no.multi. = 153
18! = 6402373705728000 no.multi. = 18 sum of 18! = 6780385526348314 no.multi. = 171
19! = 121645100408832000 no.multi. = 19 sum of 19! = 128425485935180314 no.multi. = 190
该行的作用是它定义了一条路由,该路由在名为Site viz的控制器中寻找名为$route['site'] = 'site/home';
的方法。 home
。
由于您的Site_Controller
没有Site_Controller
方法,因此您收到404错误。
尝试像这样更改home
...
Site_Controller