Important Note : output_buffering
is off and I have checked it by get_ini()
so please do not answer iteratives.
I have a simple php code:
<?php
in first step I will send a header, I also have write nothing before my php start tag and header is first:
header('Content-type: text/html; charset=utf-8');
now i want to be sure that my header has been sent so i use header_sent() function
if(!headers_sent()) {
?><script type="text/javascript">alert('No headers have been sent')</script><?php
} else {
?><script type="text/javascript">alert('headers have been sent')</script><?php
}
?>
Unfortunately I don't know why I will encountered with "No headers have been sent" while I expect headers have been sent.