![]() |
Cannot modify header information - headers already sent - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Cannot modify header information - headers already sent (/showthread.php?tid=69464) |
Cannot modify header information - headers already sent - dunkindonato - 11-27-2017 Hi! I'm using CodeIgniter for quite awhile now..and I'm currently facing an error Code: A PHP Error was encountered This is Line 75 of My_Controller PHP Code: if( ! $this->session->email || $this->session->email == NULL || $this->session->isLoggedIn !== TRUE) { just incase this is needed, I used echo in my User controller because this is where I get some ajax request. Thank you very much ![]() RE: Cannot modify header information - headers already sent - dunkindonato - 11-27-2017 UPDATE: I just found out that this one might be the one causing problem. PHP Code: $data['pending_count'] = ($pending->count * $pending->pages); I cannot use redirect(site_url('login')); below this code. But if I put redirect before $data[] it works just fine. Is there any way I can solve my error? Thank you! ![]() RE: Cannot modify header information - headers already sent - InsiteFX - 11-28-2017 You get the headers already sent error because you have written to the output already. Which is most Lilly what the $data is doing. So yes you would need to redirect before you write the $data to the view. |