Welcome Guest, Not a member yet? Register   Sign In
Message Cannot modify header information - headers already sent
#18

[eluser]Unknown[/eluser]
Hi,

I had similar problem and I would like to share info on my case Smile

I was trying to implement JSON reply with CodeIgniter but when I try to change the headers using "header("content-type:application/json")";, I got the following unexpected response.

Code:
A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at D:\xampp\htdocs\filemoo\system\application\controllers\vote.php:1)

Filename: controllers/vote.php

Line Number: 21

I then change the file encoding from UTF-8 to ANSI using Notepad++, a free text editor. And the error was gone Smile

But since I am in Asian countries, I do need UTF-8 support. So I changed the encoding from UTF-8 to UTF-8 without BOM. And then everything is going as expected. The BOM (Byte-order mask) at the beginning of UTF-8 file maybe the culprit.


Messages In This Thread
Message Cannot modify header information - headers already sent - by El Forum - 03-14-2009, 04:03 AM



Theme © iAndrew 2016 - Forum software by © MyBB