note 60079 deleted from function.session-set-save-handler by danbrown
| From: | danbrown@php.net | Date: | Sun, 23 Jan 2011 16:17:43 +0000 |
| Subject: | note 60079 deleted from function.session-set-save-handler by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-176041@lists.php.net to get a copy of this message | ||
Note Submitter: cthree at s2ki dot com
----
In reply to rudy dot metzger at pareto dot nl:
One option to work around this problem is to instantiate your database connection from within
session class:
class Session {
public $db;
public function open( $path, $name ) {
$this->db = mysql_connect(...); // or whatever works
return true;
}
...
public function close() {
mysql_close( $this->db ); // or whatever works
return true;
}
}
$session = new Session;
session_set_save_handler(
array(&$session, "open"),
...
array(&$session, "close"),
...
);
session_start();
$db =& $session->db;
...
HTH