Re: store class zithin session

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux