PHP/codeigniter - use of exit()
Posted
by Patrick
on Stack Overflow
See other posts from Stack Overflow
or by Patrick
Published on 2010-04-11T22:46:52Z
Indexed on
2010/04/11
22:53 UTC
Read the original article
Hit count: 232
codeigniter
|php
I have a few pages that require login, so all controllers that link to these pages start with
$this->checkSession();
//...rest of the code
CheckSession should verify the session is still live, otherwise display a message and stop the execution of the rest of the code in the controller:
function checkSession()
{
if (!$this->session->userdata('is_logged_in'))
{
//the session has expired!
$data['main'] = 'confirmation_message';
$data['title'] = "Session expired";
$this->load->vars($data);
$this->load->view('template');
exit();
}
}
. I was expecting these instructions to happen in sequence, but I only get a blank page. How can I make sure exit() gets executed only after all views are loaded?
© Stack Overflow or respective owner