Stop execution after call $this->load->view()

后端 未结 5 984
野性不改
野性不改 2021-01-18 01:40

In Codeigniter, How could we stop the execution after load a view?

I have tried this

function index() {
    $this->load->view(\'myView\');
             


        
5条回答
  •  -上瘾入骨i
    2021-01-18 02:10

    I know I'm late but I came across this whilst searching to find out if loading a view stops execution but apparently it does not.

    It might still be useful to someone so... To stop execution after loading a view, you can just return:

    $this->load->view('myView');
    return;
    

    This will not stop PHP (unlike die() or exit()), CI will load the view as it normally would and any following code will not run.

提交回复
热议问题