虚拟主机中的 Codeigniter 错误 404
Codeigniter in virtual host error 404
codeigniter 3.0.2
关于我的本地主机环境配置
PHP 5.2+ apache 2.4+
打印我的本地主机 CI 日志:
INFO - 2015-11-09 21:06:35 --> Config Class Initialized
INFO - 2015-11-09 21:06:35 --> Hooks Class Initialized
DEBUG - 2015-11-09 21:06:35 --> UTF-8 Support Enabled
INFO - 2015-11-09 21:06:35 --> Utf8 Class Initialized
INFO - 2015-11-09 21:06:35 --> URI Class Initialized
DEBUG - 2015-11-09 21:06:35 --> No URI present. Default controller set.
INFO - 2015-11-09 21:06:35 --> Router Class Initialized
INFO - 2015-11-09 21:06:35 --> Output Class Initialized
INFO - 2015-11-09 21:06:35 --> Security Class Initialized
DEBUG - 2015-11-09 21:06:35 --> Global POST, GET and COOKIE data sanitized
INFO - 2015-11-09 21:06:35 --> Input Class Initialized
INFO - 2015-11-09 21:06:35 --> Language Class Initialized
INFO - 2015-11-09 21:06:35 --> Loader Class Initialized
INFO - 2015-11-09 21:06:35 --> Helper loaded: url_helper
INFO - 2015-11-09 21:06:35 --> Helper loaded: file_helper
INFO - 2015-11-09 21:06:36 --> Database Driver Class Initialized
INFO - 2015-11-09 21:06:40 --> Session: Class initialized using 'files' driver.
INFO - 2015-11-09 21:06:40 --> Controller Class Initialized
INFO - 2015-11-09 21:06:40 --> File loaded: E:\phpStudy\WWW\newab\application\views\admin/login.php
INFO - 2015-11-09 21:06:40 --> Final output sent to browser
DEBUG - 2015-11-09 21:06:40 --> Total execution time: 6.1245
成功了,一切正常!
关于虚拟主机环境配置
PHP 5.2+ Apache 2.2+
打印虚拟主机 CI 日志:
INFO - 2015-11-09 20:22:56 --> Config Class Initialized
INFO - 2015-11-09 20:22:56 --> Hooks Class Initialized
DEBUG - 2015-11-09 20:22:56 --> UTF-8 Support Enabled
INFO - 2015-11-09 20:22:56 --> Utf8 Class Initialized
INFO - 2015-11-09 20:22:56 --> URI Class Initialized
INFO - 2015-11-09 20:22:56 --> Router Class Initialized
INFO - 2015-11-09 20:22:56 --> Output Class Initialized
INFO - 2015-11-09 20:22:56 --> Security Class Initialized
DEBUG - 2015-11-09 20:22:56 --> Global POST, GET and COOKIE data sanitized
INFO - 2015-11-09 20:22:56 --> Input Class Initialized
INFO - 2015-11-09 20:22:56 --> Language Class Initialized
ERROR - 2015-11-09 20:22:56 --> 404 Page Not Found: /index
它报告 404 页面未找到,一切都是 404!
为什么?比较一下,我发现在Loader Class Initialized出现这个错误。
我也尝试 $config['uri_protocol'],使用
PATH_INFO
REQUEST_URI
QUERY_STRING
它在我的本地主机上工作,但在虚拟主机中都是 404,所以它无法获取它。
请帮助我。
使用 CodeIgniter 3.0.x 所有控制器文件名都必须以大写字符开头。确保您的文件以这种方式命名。
例如,在 /application/controllers/
中,文件 a_controller.php
必须命名为 A_controller.php
同样重要的是控制器文件中 class 名称首字母大写的规则。例如这是错误的
class a_controller extends CI_Controller {
这是正确的。
class A_controller extends CI_Controller {
codeigniter 3.0.2
关于我的本地主机环境配置
打印我的本地主机 CI 日志:PHP 5.2+ apache 2.4+
INFO - 2015-11-09 21:06:35 --> Config Class Initialized
INFO - 2015-11-09 21:06:35 --> Hooks Class Initialized
DEBUG - 2015-11-09 21:06:35 --> UTF-8 Support Enabled
INFO - 2015-11-09 21:06:35 --> Utf8 Class Initialized
INFO - 2015-11-09 21:06:35 --> URI Class Initialized
DEBUG - 2015-11-09 21:06:35 --> No URI present. Default controller set.
INFO - 2015-11-09 21:06:35 --> Router Class Initialized
INFO - 2015-11-09 21:06:35 --> Output Class Initialized
INFO - 2015-11-09 21:06:35 --> Security Class Initialized
DEBUG - 2015-11-09 21:06:35 --> Global POST, GET and COOKIE data sanitized
INFO - 2015-11-09 21:06:35 --> Input Class Initialized
INFO - 2015-11-09 21:06:35 --> Language Class Initialized
INFO - 2015-11-09 21:06:35 --> Loader Class Initialized
INFO - 2015-11-09 21:06:35 --> Helper loaded: url_helper
INFO - 2015-11-09 21:06:35 --> Helper loaded: file_helper
INFO - 2015-11-09 21:06:36 --> Database Driver Class Initialized
INFO - 2015-11-09 21:06:40 --> Session: Class initialized using 'files' driver.
INFO - 2015-11-09 21:06:40 --> Controller Class Initialized
INFO - 2015-11-09 21:06:40 --> File loaded: E:\phpStudy\WWW\newab\application\views\admin/login.php
INFO - 2015-11-09 21:06:40 --> Final output sent to browser
DEBUG - 2015-11-09 21:06:40 --> Total execution time: 6.1245
成功了,一切正常!
关于虚拟主机环境配置
打印虚拟主机 CI 日志:PHP 5.2+ Apache 2.2+
INFO - 2015-11-09 20:22:56 --> Config Class Initialized
INFO - 2015-11-09 20:22:56 --> Hooks Class Initialized
DEBUG - 2015-11-09 20:22:56 --> UTF-8 Support Enabled
INFO - 2015-11-09 20:22:56 --> Utf8 Class Initialized
INFO - 2015-11-09 20:22:56 --> URI Class Initialized
INFO - 2015-11-09 20:22:56 --> Router Class Initialized
INFO - 2015-11-09 20:22:56 --> Output Class Initialized
INFO - 2015-11-09 20:22:56 --> Security Class Initialized
DEBUG - 2015-11-09 20:22:56 --> Global POST, GET and COOKIE data sanitized
INFO - 2015-11-09 20:22:56 --> Input Class Initialized
INFO - 2015-11-09 20:22:56 --> Language Class Initialized
ERROR - 2015-11-09 20:22:56 --> 404 Page Not Found: /index
它报告 404 页面未找到,一切都是 404!
为什么?比较一下,我发现在Loader Class Initialized出现这个错误。
我也尝试 $config['uri_protocol'],使用
PATH_INFO
REQUEST_URI
QUERY_STRING
它在我的本地主机上工作,但在虚拟主机中都是 404,所以它无法获取它。
请帮助我。
使用 CodeIgniter 3.0.x 所有控制器文件名都必须以大写字符开头。确保您的文件以这种方式命名。
例如,在 /application/controllers/
中,文件 a_controller.php
必须命名为 A_controller.php
同样重要的是控制器文件中 class 名称首字母大写的规则。例如这是错误的
class a_controller extends CI_Controller {
这是正确的。
class A_controller extends CI_Controller {