CodeIgniter - How to check session to be used at every methods

前端 未结 3 1092
无人及你
无人及你 2021-01-05 09:27

Let say at my controller named Book, I have many methods, such as get_book(); read_book(); remove_book();

<
3条回答
  •  余生分开走
    2021-01-05 10:09

    You can use the method in constructor of controller, like:

    if ( ! $this->session->userdata('logged_in'))
        {   
                redirect('login');
        }
    
    

提交回复
热议问题