Re: PHP Always Outputs [message #178667 is a reply to message #178657] |
Mon, 16 July 2012 18:18 |
Tim Streater
Messages: 328 Registered: September 2010
Karma:
|
Senior Member |
|
|
In article <ju0o9o$6dt$1(at)dont-email(dot)me>,
"Álvaro G. Vicario" <alvaro(dot)NOSPAMTHANX(at)demogracia(dot)com(dot)invalid> wrote:
> El 14/07/2012 6:21, Ryan escribió/wrote:
>> I want a php script to run and simply output nothing. But even this
>> script:
>>
>> <?php
>> ?>
>>
>> will output this html
>>
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>> <HTML><HEAD>
>> <META content="text/html; charset=windows-1252"
>> http-equiv=Content-Type></HEAD>
>> <BODY></BODY></HTML>
>>
>> Is there a setting somewhere in my php or apache config that needs to be
>> turned off?
>
> Apparently, you are inspecting the output through a web browser and your
> browser has reached the conclusion that you are loading an HTML
> document. Since your (empty) code is not valid HTML, the browser does
> what it's been designed to do: fix it. In this case, it adds a few tags
> to obtain a valid empty HTML document.
>
> The PHP way to make sure your output is not handled as HTML is to send
> an appropriate HTTP header, e.g.:
>
> header('Content-Type: text/plain');
header ('Content-Type: text/plain; charset=utf-8');
is better.
--
Tim
"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
|
|
|