note 35728 added to ref.session
| From: | Gareth at rn2 dot php dot net | Date: | Fri, 12 Sep 2003 11:29:45 +0000 |
| Subject: | note 35728 added to ref.session | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-56367@lists.php.net to get a copy of this message | ||
I thought this might be of some help to someone as I could not find the answer anywhere.
If you want to store an object in a session (from a class) using php 4.06 (Many ISPs use this as a
production server).
You must do this :-
class Shopping Carte {
function saveCarte() {
global $HTTP_SESSION_VARS;
global $shoppingCarte;
$shoppingCarte=serialize($this);
session_register("shoppingCarte");
}
}
Not this (Doesn't work in php 4.06):-
class Shopping Carte {
function saveCarte() {
global $HTTP_SESSION_VARS;
$shoppingCarte=serialize($this);
$HTTP_SESSION_VARS['shoppingCarte'];
}
}
----
Manual Page -- http://www.php.net/manual/en/ref.session.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35728
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35728&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35728&report=yes