Posted by Adam on 04/17/05 03:26
Hallo everybody,
hope I am writing to correct mailinglist(^_^*)...
I have troubles with sessions and descructor in php5. Can not set session
variable in destructor when it's called implicitly. Do You know solution
please?
I think problem is that session is stored before imlicit object destruction
*doh*
example.php:
<?php
session_start();
session_register("variable");
// singleton for request
class Request {
function __destructor() {
$_SESSION["variable"] = "hallo";
}
}
$req = Request::getInstance();
$req->doSomeThink();
echo "This should be hallo 2nd time: " . $_SESSION["variable"]; //
unfortunatly this is not set
echo " <a href='example.php'>Click and cry;-(</a>";
// implicit desturctor call
?>
Thank You very much...
BR
a3c
Navigation:
[Reply to this message]
|