为什么我上传到托管时会在codeigniter中出现error_404.php错误?

 快乐生活HAPPY-GO 发布于 2022-12-08 19:29

我上传到主机时我的网站不起作用,但它在localhost中工作.当我尝试访问url时,alwasy显示错误 - 12-01-14 06:33:25 - > 404页面未找到:/ index(日志文件),我收到错误.

这是我的托管用户名和密码访问控制面板:

https://cp.supremecenter300.com

客户ID:142606

登录:hengsopheak

密码:2142885

已定义('BASEPATH')或退出('不允许直接访问脚本');

function __autoload($ classname){if(strpos($ classname,'CI_')!== 0){$ file = APPPATH.'libraries /'.$ classname.'.PHP'; if(file_exists($ file)){@ include_once($ file); }}}

$ config ['base_url'] ='';

$ config ['index_page'] ='';

$ config ['uri_protocol'] ='PATH_INFO';

$ config ['url_suffix'] ='';

$ config ['language'] ='english';

$ config ['charset'] ='UTF-8';

$ config ['enable_hooks'] = FALSE;

$ config ['subclass_prefix'] ='MY_';

$ config ['composer_autoload'] = FALSE;

$ config ['allowed_uri_chars'] ='az 0-9~%.:_ - ';

$ config ['allow_get_array'] = TRUE; $ config ['enable_query_strings'] = FALSE; $ config ['controller_trigger'] ='c'; $ config ['function_trigger'] ='m'; $ config ['directory_trigger'] ='d'; //实验目前尚未使用

$ config ['log_threshold'] = 4;

$ config ['log_path'] ='';

$ config ['log_file_extension'] ='php';

$ config ['log_date_format'] ='mdy H:我:s';

$ config ['error_views_path'] ='application/views/errors';

$ config ['cache_path'] ='';

$ config ['encryption_key'] ='sdfasdfasdfasdfadf';

$ config ['sess_driver'] ='cookie'; $ config ['sess_valid_drivers'] = array(); $ config ['sess_cookie_name'] ='ci_session'; $ config ['sess_expiration'] = 7720; $ config ['sess_expire_on_close'] = FALSE; $ config ['sess_encrypt_cookie'] = TRUE; $ config ['sess_use_database'] = TRUE; $ config ['sess_table_name'] ='ci_sessions'; $ config ['sess_match_ip'] = TRUE; $ config ['sess_match_useragent'] = TRUE; $ config ['sess_time_to_update'] = 300;

$ config ['cookie_prefix'] =''; $ config ['cookie_domain'] ='vtrashop.com/'; $ config ['cookie_path'] ='/'; $ config ['cookie_secure'] = FALSE; $ config ['cookie_httponly'] = FALSE;

和路由器

$route['default_controller'] = 'page';
$route['cat/(:num)'] = 'cat/index/$1/$2/$3';
$route['detail/(:num)'] = 'detail/index/$1/$2';
$route['404_override'] = '';

在控制器文件名中:页面类名:页面.

data['subview'] = 'page';
        $this->load->view('_main_layout', $this->data);
        }
?>

和.htaccess

# Set PHP Time Zone:
#SetEnv TZ America/New_York


#Option +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond $1 !^(index\.php|pages|video|images|social|style|sliderengine|bar|robots\.text)

RewriteRule ^(.*)$ index.php?/$1 [QSA,L]


我只得到这条消息消息:include():无法打开'application/views/errorshtml/error_404.php'以包含(include_path ='.; c:\ php\pear')

我现在该怎么办

1 个回答
  • 大多数情况下,由于文件命名问题,会发生此错误.我认为你正在使用Linux主机.所以我也面临同样的问题,最后我找到了解决方案,我们不能使用大写字符的文件名.

    如果我们有一个名为my_controller的控制器,那么文件名应该是这样的my_controller.php,并且不要使用像My_Controller.php这样的UPPERCASE字符,myController.php作为文件名.

    2022-12-11 02:10 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有