更改codeiniter中的默认控制器时出错

时间:2016-10-27 09:52:15

标签: php codeigniter

这是我的controller.php和route.php文件。

Index_controller.php

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

class Index_Controller extends CI_Controller{

    public function index()
    {
        echo "i am here"; die();
        if($this->session->userdata('user_role')=="Employer")
        {
            redirect('/pages/dashboard/get_empr_info', 'refresh'); //refresh..?
        }
        if($this->session->userdata('user_role')=="Employee")
        {
            redirect('/pages/dashboard/get_emp_info', 'refresh');
        }
        else
        {
            $data['no_of_employees']    =   $this->employee_model->get_noof_employess();
            $data['no_of_employers']    =   $this->employee_model->get_noof_employers();

            $data['title']= '';
            $this->load->view('header/header_view',$data);
            $this->load->view("pages/index_view.php",$data);
            $this->load->view('footer/footer_view',$data);
        }
    }
}

route.php

$route['default_controller'] = 'index_controller';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

我会感激任何类型的帮助。 谢谢

0 个答案:

没有答案