|
Posted by Rami Elomaa on 05/02/07 06:13
"geevaa" <govivasanth@gmail.com> wrote in message
news:1178079630.877693.308390@h2g2000hsg.googlegroups.com...
> On Apr 25, 12:21 pm, "Rami Elomaa" <rami.elo...@gmail.com> wrote:
>> "geevaa" <govivasa...@gmail.com> wrote in message
>>
>> news:1177485085.994168.313590@n35g2000prd.googlegroups.com...
>>
>>
>>
>> > Hi Group,
>> > The page 167 of book Learning PHP5 by David Sklar says that
>> > setcookie() and session_start() must be added before any output.
>> > I tried to use that functions at last line but no warning!.
>> > The warning which i got 1 month back is not issued now.
>> > ------------------------------------------------------------------
>> > The following is my PHP program
>> > <?php
>>
>> > function Intelli()
>> > {
>> > echo"Hello P";
>> > }
>>
>> > function Bitz()
>> > {
>> > echo"Hello MySQL";
>> > }
>>
>> > ;
>> > $a = 1;
>> > if($a)
>> > $myFunc = 'Intelli';
>> > else
>> > $myFunc ='Bitz';
>>
>> > $myFunc();
>> > print'header';
>>
>> > session_start();
>> > setcookie('userid')
>> > ?>
>>
>> > ----------------------------------------------------------------
>> > The following is the output i got.
>> > There is no warning
>>
>> > [tdphpadmin@trgbws40 ~/public_html/demo]$ php dynamicfun.php
>> > X-Powered-By: PHP/5.2.0
>> > Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/
>> > Set-Cookie: PHPSESSID=bp1m17rlrgsa5g19tfekidov31; path=/
>> > Expires: Thu, 19 Nov 1981 08:52:00 GMT
>> > Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-
>> > check=0
>> > Pragma: no-cache
>> > Set-Cookie: userid=
>> > Content-type: text/html
>>
>> > Hello Pheader
>> > -------------------------------------------------------------
>>
>> > can any one explain why i din get the warning.....
>>
>> Output buffering on by default?
>>
>> echo ini_get('output_buffering');
>>
>> --
>> Rami.Elo...@gmail.com
>>
>> "Good tea. Nice house." -- Worf
> my php coding is
>
> <?php
>
> echo ini_get('output_buffering');
>
> ?>
>
> My output is
>
> [tdphpadmin@sysaws40 ~/public_html/php]$ php inigetoutputbuffering.php
> X-Powered-By: PHP/5.2.0
> Content-type: text/html
>
> 4096
Well it's on then, since it returns the buffer size. The body, ie. output is
sent only when the script exits so that's why you get no warning.
--
Rami.Elomaa@gmail.com
"Good tea. Nice house." -- Worf
Navigation:
[Reply to this message]
|