FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » PHP Always Outputs
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: PHP Always Outputs [message #178657 is a reply to message #178624] Mon, 16 July 2012 09:52 Go to previous messageGo to previous message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma:
Senior Member
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');

Additionally, you can remove the trailing "?>" closing tag, which is not
mandatory and might lead to white space being sent to the browser.

The use of uppercase tags and Win-1252 encoding suggests we are talking
about Internet Explorer. This browser is known for ignoring the
Content-Type under certain circumstances. But of course that's another
story.

--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Business Developer for IT company
Next Topic: decode encoded url
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 12 22:16:50 GMT 2024

Total time taken to generate the page: 0.04647 seconds