Ejemplo n.º 1
0
 static function write($id, $sess_data)
 {
     if (empty(self::$session_save_path)) {
         self::$session_save_path = self::savePath();
     }
     if (!empty(self::$session_db_connection)) {
         $data_field = self::$session_db_data_field;
         $updated_field = self::$session_db_updated_field;
         self::$session_db_row->{$updated_field} = date('Y-m-d H:i:s');
         self::$session_db_row->{$data_field} = $sess_data;
         self::$session_db_row->save();
     } else {
         $sess_file = self::$session_save_path . "/sess_{$id}";
         $fp = fopen($sess_file, "w");
         if (!$fp) {
             return false;
         }
         $return = fwrite($fp, $sess_data);
         fclose($fp);
         return $return;
     }
     return true;
 }