错误:找不到 404 页面,代码点火器


Error:404 page not found, code igniter

controller.php

<?php
    define('_root',$_SERVER['DOCUMENT_ROOT']);
    include(_root.'/innoshop/application/models/model.php');
     // include_once 'model.php';
    class Controller {
     public $model;
     public function __construct()  
        {  
            $this->model = new Model();
        }

如果我输入本地主机:8888/项目名称,我得到这样的错误

 404 Page Not Found
The page you requested was not found.

有人帮助我

正如伙计们所说,您应该阅读文档,因为这是非常错误的。要修复,请执行此操作..

class Controller extends CI_Controller{//better to give your controller a more meaningful name
       public function __construct(){
           parent::__construct();
           //use the CI loader - the model will then be available like this $this->model->some_function();
           $this->load->model('model');//better to give your model a more meaningful name as well 
       }
       //the index method allows you to use just the controller name in your URI eg localhost:8888/projectname/index.php/controller 
       public function index(){
           echo 'something to see';
       }
        //an alternative controller method get it like localhost:8888/projectname/index.php/controller/your_method_name
        public function your_method_name(){
           echo 'something to see in your method';
        }
} 

如果要删除索引.php请在 URI 中搜索与 CodeIgniter 中的 .htaccess 相关的问题

如果您希望能够使用localhost:8888/projectname这样的 URI,那么您需要在 config/routes 中添加一个路由.php该路由定义默认控制器,如下所示$route['default']='controller';