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

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