note 21474 deleted from ref.session by danbrown
| From: | danbrown@php.net | Date: | Sun, 20 Jul 2008 18:46:15 +0000 |
| Subject: | note 21474 deleted from ref.session by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142248@lists.php.net to get a copy of this message | ||
Note Submitter: twocandles3000@hotmail
----
Storing class instances in session.
As long as a class MUST be declared BEFORE the session starts and unserializes the session info,
i'm using this approach.
0: Set in php.ini session.auto_start = 0
1: create myclass.inc where the class is declared.
2: put in another file, say header.inc, this lines of code:
include_once( "myclass.inc" );
session_start();
3: set in php.ini the auto_prepend_file= "path_to_my_file/header.inc"
Following this steps, the session is started at every page and myclass is always available, avoiding
to write the session_start() function at every page.