codeigniter - how to display the content before exit() in php? -
i'm using codeigniter. , in 1 of admin controller, after admin logged in, wanted create switch check admin level. if level below number, cannot view page. , instead, restriction notice page loaded , page stop loading.
function add_user() { $this->set_admin_level(9); // stuffs } private function set_admin_level($level){ if ($this->session->userdata('admin_level') < $level ) { $this->load->view("admin/restriction"); exit(); } }
i tried exit() , die(), both of them killed entire page without displaying anything. know can if , redirect method, wanted know if can previous way.
try this:
private function set_admin_level($level){ if ($this->session->userdata('admin_level') < $level ) { return $this->load->view("admin/restriction"); } }
Comments
Post a Comment