Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 错误:未在CI 3.0中的路由文件中指定默认路由_Php_Codeigniter_Routes - Fatal编程技术网

Php 错误:未在CI 3.0中的路由文件中指定默认路由

Php 错误:未在CI 3.0中的路由文件中指定默认路由,php,codeigniter,routes,Php,Codeigniter,Routes,我已经成功地在我的本地机器上运行了测试网页,它运行正常!但是,当我将其上载到生产服务器(iPage)时,我遇到了以下错误: 遇到错误 无法确定应显示的内容。未在路由文件中指定默认路由 我这里有.htacess文件: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index\.php|assets|img|bg|robots

我已经成功地在我的本地机器上运行了测试网页,它运行正常!但是,当我将其上载到生产服务器(iPage)时,我遇到了以下错误:

遇到错误
无法确定应显示的内容。未在路由文件中指定默认路由

我这里有.htacess文件:

 RewriteEngine On
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond $1 !^(index\.php|assets|img|bg|robots\.txt)
 RewriteRule ^(.*)$ index.php?/$1 [L] 
在应用程序文件夹之外

在my routes.php中:

$route['default_controller'] = 'login';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
在my config.php中:

$config['base_url'] = 'http://example.com/System';
$config['uri_protocol'] = 'REQUEST_URI';
$config['enable_query_strings'] = TRUE;
控制器文件夹中有login.php和ff代码:

 defined('BASEPATH') OR exit('No direct script access allowed');

class login extends CI_Controller {
    function __construct() {
        parent::__construct();
        $this->load->model('login_model');
        /* enable session */
        $this->load->library('session');
    }

 public function index()
    {
        if ( ! file_exists(APPPATH.'/views/index.php'))
        {
            /* Whoops, we don't have a page for that! */
               show_404();

        }

        $this->load->view('index'); 
       $this->load->view('templates/footer');   

   }    
我是错过了还是做错了什么?

您的路线包含

$route['default_controller'] = 'login';
所以在控制器中,页面名称应该是
login.php

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

    class Login extends CI_Controller//check this
    {
        public function  __construct()
        {
            parent::__construct();
    }
内部
login.php

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

    class Login extends CI_Controller//check this
    {
        public function  __construct()
        {
            parent::__construct();
    }

CodeIgniter 3要求以Ucfirst方式命名类,并且文件名必须与类名匹配


因此,您需要将“login.php”重命名为“login.php”,并将类声明更改为
class login extensed CI_Controller

是的,在我的控制器中,我有login.phpcheck文件,基本url也应该是
login
class login extensed CI_Controller{}。我这里的类名很小。所以我的文件名也应该是大写的,对吗?不。可以更改此
类登录扩展CI_控制器
只是一个提示如果我或其他人试图弄明白这一点,只需检查您的环境是否符合您的期望。