Re: [PHP] A stupid question?



Eric Butera schreef:
On Jan 17, 2008 9:54 PM, Shelley Shyan <Shelley.Shyan@xxxxxxxxxxxxx> wrote:
Hi all,

Maybe this is a somehow stupid question.

I want to know how php could know whether session_start() has been called, that is, whether session has been started.

I Googled, but got little help.

Thank you for help!
Any tip is greatly appreciated.

Regards,
Shelley




One other thing is you won't be able to start a session if headers
have been sent. It is a good idea to use output buffering to help aid
with this.

no it's not a good idea to use output bufferin to 'help aid' this. instead
write code that is logically structured so that the initialization of your pages/app/scripts
occurs BEFORE any output is generated.

to avoid spurious output of whitespace avoid including the trailing '?>' is
included php[-only] files. (and ignore whatever Tedd says on the subject ;-)

If headers have been sent you'll get a nasty warning.

if (headers_sent()) {
echo "oops!";
}

use code to avoid warnings.


It can be a php.ini setting or you can simply call ob_start() on the
first line of your script.

.



Relevant Pages

  • Re: [PHP] A stupid question?
    ... I want to know how php could know whether session_start() has been called, that is, whether session has been started. ... It is a good idea to use output buffering to help aid ... no it's not a good idea to use output bufferin to 'help aid' this. ... to avoid spurious output of whitespace avoid including the trailing '?>' is ...
    (php.general)
  • Re: [PHP] A stupid question?
    ... I want to know how php could know whether session_start() has been called, that is, whether session has been started. ... no it's not a good idea to use output bufferin to 'help aid' this. ... to avoid spurious output of whitespace avoid including the trailing '?>' is ... you don't want to use output buffering if you can help it. ...
    (php.general)
  • Re: [PHP] A stupid question?
    ... I want to know how php could know whether session_start() has been called, that is, whether session has been started. ... It is a good idea to use output buffering to help aid ... If headers have been sent you'll get a nasty warning. ...
    (php.general)
  • Re: Security problem/issue ASP.Net
    ... > The Web Server is set to: ... > What else can I do to avoid this session mix? ... >>> page myprofile, the first user sees his profile (the ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Coding inside the debugger
    ... >you are trying to avoid its thread becomming blocked on the read where ... >no more packets are left to transfer. ... brief periods in the midst of the session. ... "The aim of science is not to open the door to infinite wisdom, ...
    (comp.object)

Loading