note 21362 added to function.session-start
| From: | ying at bcgsearch dot com | Date: | Thu, 09 May 2002 21:08:13 +0000 |
| Subject: | note 21362 added to function.session-start | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-30402@lists.php.net to get a copy of this message | ||
I have learned the following lessons on session_start():
1. On each page you wish to use session variables, you have to call session_start() first.
2. Only the first time you create a session, session_start() has to be called before <html>
tag, as mentioned in some notes above. This does not apply to subsequent session_start() calls to
reactivate an existing session.
3. Contrary to some comments above, once a variable is registered as a session variable, the
variable is global. Wherever its value is changed, the variable is going to keep the most updated
value across pages. (I am not referring to functions though, which would be different because of
scope issues.)
--
http://www.php.net/manual/en/function.session-start.php
http://master.php.net/manage/user-notes.php?action=edit+21362
http://master.php.net/manage/user-notes.php?action=delete+21362
http://master.php.net/manage/user-notes.php?action=reject+21362