Re: How to preserve object with session
| From: | Teodor Cimpoesu | Date: | Fri, 07 Jul 2000 13:46:07 +0000 |
| Subject: | Re: How to preserve object with session | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-5378@lists.php.net to get a copy of this message | ||
Hi Przem!
On Fri, 07 Jul 2000, Przem Kowalczyk wrote:
> Hi
>
> I know, that sessions don't preserve object's methods.
half true.
If you have the class definition at the unserialization time
you'll have the methods too i.e.
include 'class_definition.inc';
session_start();
> But how can I retrive previous object state on the next page?
>
> An example:
>
> first.php:
>
> $object = new My_object()
>
> session_register('object');
>
> $object -> variable = 3;
>
>
> second.php:
>
> ??
where is My_Object class defined?
> I would like to have the same object (even recreated with new), but with
> previous variables.
> Is that possible? How to do it?
see above.
gl
-- teodor