Re: store class zithin session
| From: | Eric Butera | Date: | Thu, 20 Nov 2008 14:31:28 +0000 |
| Subject: | Re: store class zithin session | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-283593@lists.php.net to get a copy of this message | ||
On Thu, Nov 20, 2008 at 8:37 AM, Yeti <yeti@myhich.com> wrote:
> 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);
> }
>
> ?>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Autoload. Why on earth would you do such a thing?