0

When I'm using php header function I'm getting an error like this,

Cannot modify header information - headers already sent 

I know i should use ob_start(); at the beginning of the code for rid this error and I used too but nevertheless I'm getting error, Please tell me where I'm going wrong? This is my code where I'm getting error.

function insert_charset_header() { 
header('Content-Type: text/html; charset=UTF-8'); 
exit; 
} 

Thanks in advance

Shubham Verma
  • 141
  • 10

1 Answers1

0

That should be your first function before anything else, also check for any extra space in your code at the end of your file: see this question/answer: How to fix "Headers already sent" error in PHP

Community
  • 1
  • 1
Allende
  • 1,480
  • 2
  • 22
  • 39