我是代码点火器的新手,在我的项目文件中有以下设置
型号:
型号1
型号2
控制器:
Controller1[只有索引方法]
Controller2[有自己的索引方法]
视图:
Views/MyFolder1/index.php[这是Controller1]的视图
Views/MyFolder2/index.php[这是Controller2]的视图
Routes.php具有以下代码
$route['MyFolder1'] = 'Controller1/index'; // Route to Controller 1 index
$route['MyFolder2'] = 'Controller2/index'; // Route to Controller 2 index
$route['default_controller'] = 'Controller1';
config.php有
$config['base_url'] = 'http://localhost/projectname';
当我试图打电话http://localhost/projectname/Controller2/index.php或http://localhost/Controller2我一直收到错误404找不到页面。你能帮忙解决这个问题吗?
感谢
在控制器名称之前添加index.php,类似localhost/projectName/index.php/Controller2
修复这个答案
CodeIgniter从url 中删除index.php
您应该将其称为http://localhost/projectname/MyFolder2
您使用的$routes
的密钥是您应该打开的url。