Codeigniter中的路径 - 找不到404页面

Codeigniter中的路径 - 找不到404页面

问题描述:

有人可以告诉我,问题在哪里?

Can someone tell me, where the issue is ??

这是我的控制器

class Support extends CI_Controller {
    public function __construct()
    {
        parent::__construct();
        $this->load->model('support_model');
        $urlarray = array("index","delete");
        if(!in_array($this->uri->segment(2),$urlarray)){
            $this->viewticket($this->uri->segment(2));
        }
    }

    public function viewticket($id){
        if(!empty($id)){
            $this->load->view('templates/logged_header');       
            $this->load->view('support/view');
            $this->load->view('templates/footer');
        }
    }
}

这是我的routes.php

Here is my routes.php

$route['default_controller'] = "welcome";
$route['benefits'] = 'welcome/benefits';
$route['faqs'] = 'welcome/faqs';
$route['distributors'] = 'welcome/distributors';
$route['contact'] = 'welcome/contact';
$route['purchase'] = 'welcome/purchase';

//login routes
$route['login'] = 'login/index';
$route['logout'] = 'login/logout';

$route['404_override'] = '';

localhost / ciproj / support / hello-world 给我 404页面找不到错误

如果我使用 c $ c> $ this-> load-> view('templates / footer'); 后,页面显示为空白页。

If I use exit; after $this->load->view('templates/footer');, the page is showing me blank page.

我在支持相关的路由中没有任何东西,并且每个其他方法都在工作
在路由中缺少任何东西

I don't have anything in routes related to support and every other method is working Is there anything that i'm missing in routes ??

感谢您的帮助。

判断标题,首先检查您的服务器使用 CGI / FastCGI 运行PHP(或者可以通过 phpinfo() )。

Judging the title, first of all check if your server is running PHP using CGI/FastCGI or not (you could simply check that by phpinfo()).

如果是, config.php

$config['uri_protocol'] = "REQUEST_URI";






返回主题,您可以在 routes.php 文件中使用下面的单行路由:


Back to the topic, you could achieve that by using the single-line route below within your routes.php file:

$route['support/(?!index)(?!delete)(:any)'] = "support/viewticket/$1";

__结构方法中删除这些行:

$urlarray = array("index","delete");
if(!in_array($this->uri->segment(2),$urlarray)){
    $this->viewticket($this->uri->segment(2));
}

让我知道它是如何工作的。

Let me know how it works.