2014-09-04 123 views
0

我是codeigniter的新手。我需要从一个页面导航到另一个页面的帮助。 我正在使用一个小型应用程序,其中仪表板就像管理员文件夹。 我有一个管理员称为本地主机/ koeweb /仪表板加载罚款。 现在试图去到另一个网页管理员中,说本地主机/ koeweb /仪表/ 2页,我也得到404 Page Not Found.Codeigniter页面导航错误

这里是我的代码

class Dashboard extends CI_Controller { 
    public function __construct() { 
    parent::__construct(); 
    $this->load->model('parish_model'); 
    } 

    public function index() { 
    $this->load->view('dashboard/inc/header_view'); 
    $data['query'] = $this->parish_model->getParish(); 
    $this->load->view('dashboard/dashboard_view', $data); 
    $this->load->view('dashboard/inc/footer_view'); 
    } 

    public function page2() { 
    $this->load->view('dashboard/inc/header_view'); 
    $this->load->view('dashboard/add_parish'); 
    $this->load->view('dashboard/inc/footer_view'); 
    } 
} 
+1

你可以用这个URL HTTP访问您的第2页://localhost/koeweb/index.php/dashboard/page2? – Zeeshan 2014-09-04 09:14:18

+0

你的文档根目录下是否有htaccess? – Shin 2014-09-04 09:46:54

+0

请检查你的application/config/config.php($ config ['index_page'])。如果你在.htaccess文件中设置了重写规则,那么$ config ['index_page'] =''否则$ config ['index_page'] ='index.php' – k10gaurav 2014-09-04 10:32:59

回答

0

创建.htaccess在你的文档根目录下内容

RewriteEngine on 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php/$1 [L] 

或试图index.php

访问网址

http://localhost/koeweb/index.php/dashboard/page2