当我检查正在构建的复选框时,该站点将脱机,构造函数需要加载construction_view。但是当under_construction = 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);
}
由于
答案 0 :(得分:0)
将$construction
项添加到index()
,可以缓解您的问题。加载一个或另一个。