Discussion: Header Question
Afficher un message
Vieux 26/03/2008, 15h12   #11
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Header Question

Satya wrote:
> On Mar 26, 5:06 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> m...@mtekusa.com wrote:
>>> On Mar 25, 11:03 pm, "Mario Adolf" <mo...@ultrafx.de> wrote:
>>>> Martin wrote:
>>>>> It doesn't have to be the first thing in your script but it does have
>>>>> to be the first thing that is served out. I have a couple of scripts
>>>>> where the header is 25-30 lines down in the script; but, it's the
>>>>> first thing that the script sends out
>>>>> Check your script. You must have something being served out prior to
>>>>> your header. Maybe something in an included file that's at the top of
>>>>> your script?
>>>> I've also learnt the hard way that even just a blank line preceeding your
>>>> code stuffs it up.
>>>> header can be real bitchy.
>>>> HTH
>>>> Mario
>>> Found it!!!
>>> I have an include file, which is a very small php script which
>>> initializes some variables. Basically it looks like this:
>>> <?
>>> init variables
>>> ?>
>>> It outputs nothing!! Why is this a problem???
>>> So, I guess I need to figure out how to include this file
>>> properly......any suggestions??

>> Just ensure you have no space before or after the braces in the included
>> file. ANY output - even white space - will cause headers to be sent
>> and, as a result, the header() call to fail.
>>
>> Also, you should always have the following in your php.ini file on your
>> development system:
>>
>> error_reporting=E_ALL (or E_ALL | E_STRICT)
>> display_errors=on
>>
>> This would have displayed an error message when the header() call failed
>> and identifying where the output was initiated.
>>
>>> Also, on another note: I know that if my PHP script contains a FORM,
>>> I can pass variables between scripts. But, if I just change the
>>> header location, how can I pass the variable to the php script I am
>>> calling???

>> You can pass them as GET values or in the $_SESSION array. Personally,
>> I prefer the latter.
>>
>>> Thanks!
>>> John

>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> ==================- Hide quoted text -
>>
>> - Show quoted text -

>
> and, use ob_start(); at the top. Then any output by mistake will not
> be out-putted.
>
> http://satya61229.blogspot.com/2007/...fy-header.html
>


WRONG, WRONG, WRONG! All that does is hide the error, not fix it.

The problem still exists, and ob_start() causes other problems - like
delaying output to the browser, which means higher server loads and
poorer performance to the client.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

  Réponse avec citation
 
Page generated in 0,07853 seconds with 9 queries