I have a PHP file, sometimes called a page that starts a session, Ever since the session started, so when I have the session_start ()
on this script, I sometimes get the "Session preceding" error message, The lines are inserted:
if (! Isset ($ _COOKIE ["PHPSESSID"])) {session_start (); }
But this time I got this warning message:
Notice: Undefined variable: _SESSION
is what This is a better way to check whether the session has already started.
If I use @ session_start
, will it work properly and just stop the warnings? Recommended method for
Source:
PHP & lt; 5.4.0
if (session_id () == '') {session_start (); }
No comments:
Post a Comment