note 13677 deleted from function.session-register by jimw
| From: | jimw@php.net | Date: | Tue, 18 Dec 2001 22:27:16 +0000 |
| Subject: | note 13677 deleted from function.session-register by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23267@lists.php.net to get a copy of this message | ||
Found get around for defining class before session_start() call.
Serialize your object and store it in session as a string. When you need it, just pick string
variable up and unserialize it.
Example:
Registering:
session_start();
// you can define Bummer here
class Bummer ....
$bum=new Bummer();
$bum->id = session_id();
$bum->object_name = "bummer";
$ser_bum=serialize($bum);
session_register("ser_bum");
Getting object back:
session_start();
$bum = unserialize($ser_bum);