2014-09-04 115 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