日期:2011-12-17  浏览次数:20738 次

  1. <?php 
  2. class SessionToDB 
  3. { 
  4.     private $_path         = null; 
  5.     private $_name         = null; 
  6.     private $_pdo          = null; 
  7.     private $_ip           = null; 
  8.     private $_maxLifeTime  = 0; 
  9.      
  10.     public function __construct(PDO $pdo) 
  11.     { 
  12.         session_set_save_handler( 
  13.             array(&$this, 'open'), 
  14.             array(&$this, 'close'), 
  15.             array(&$this, 'read'), 
  16.             array(&$this, 'write'), 
  17.             array(&$this, 'destroy'), 
  18.             array(&$this, 'gc')                                                             
  19.         ); 
  20.          
  21.         $this->_pdo   =