PHP/codeigniter - use of exit()

前端 未结 8 982
不思量自难忘°
不思量自难忘° 2020-12-28 16:46

I have a few pages that require login, so all controllers that link to these pages start with

$this->checkSession();
//...rest of the code
相关标签:
8条回答
  • 2020-12-28 17:20

    In this case you should not use exit, what you should do if the session is not valid is redirect your app using example:

    redirect('/init/login/','refresh');
    
    0 讨论(0)
  • 2020-12-28 17:23

    Put the code in a variable and write it.

    $html = $this->load->view('template',null,true);
    echo $html;
    exit();
    
    0 讨论(0)
提交回复
热议问题