note 21474 added to ref.session
| From: | twocandles3000 at hotmail dot php dot net | Date: | Tue, 14 May 2002 15:34:08 +0000 |
| Subject: | note 21474 added to ref.session | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-30630@lists.php.net to get a copy of this message | ||
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.
php 4.2.0 and 4.2.1, Apache 1.3 and W2K Pro.
--
http://www.php.net/manual/en/ref.session.php
http://master.php.net/manage/user-notes.php?action=edit+21474
http://master.php.net/manage/user-notes.php?action=delete+21474
http://master.php.net/manage/user-notes.php?action=reject+21474