Re: store class zithin session

From: Date: Thu, 20 Nov 2008 13:37:40 +0000
Subject: Re: store class zithin session
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-283592@lists.php.net to get a copy of this message
If you can't load the class before calling session_start you can store the serialized object in a file and simple set a $_SESSION['path_to_file'] session variable.. EXAMPLE: <?php session_start(); //some code class apple_tree { var $apples = 17; } $temporary_file = 'appletree.txt'; $file_content = serialize(new apple_tree()); if ($fp = fopen($temporary_file, 'w')) { fwrite($fp, $file_content); $_SESSION['path_to_file'] = $temporary_file; fclose($fp); } ?>

« previous php.general (#283592) next »