是否可以停止构造函数加载索引函数


Is it possible to stop the constructor loading the index function?

当我选中"正在构建"复选框时,站点将脱机,构造函数需要加载construction_view。但是,当under_constructure=1时,我如何才能停止构造函数加载索引函数?我试着退出;die()返回;但是它仍然加载索引函数。

function __construct()
    {
        parent::__construct();
        $this->load->helper('breadcrumb');
        $this->load->model('Site_model');
        $this->footer['footer'] = $this->Site_model->get_allCategories();
        $this->load->vars($this->footer);
        $construction = $this->Site_model->construction();
        if ($construction->under_construction == 1) {
            $this->load->view('construction_view');
            exit; // die(); // return;
        }
    }
function index(){
    $this->load->model('Site_model');
    $data = array();
    $title['title'] = 'Nordia - Home';
    $data['categorieInfo'] = $this->Site_model->get_allCategories();
    $this->load->view('head_view',$title);
    $this->load->view('nav_view');
    $this->load->view('banner_view');
    $this->load->view('categories_view',$data);
    $this->load->view('footer_view',$this->footer);
}

感谢

$construction项添加到index(),应该可以缓解您的问题。加载一个或另一个。