示例#1
0
 public static function load($options = [], $handler = null)
 {
     $bag = new \Symfony\Component\HttpFoundation\Session\Attribute\NamespacedAttributeBag();
     if (isset($handler['settings']['interface'])) {
         switch ($handler['settings']['interface']) {
             case 'pdo':
                 $storage = new NativeSessionStorage($options, new PdoSessionHandler($handler['db'], $handler['settings']));
                 break;
             default:
                 $storage = new NativeSessionStorage($options);
                 break;
         }
     } else {
         $storage = new NativeSessionStorage($options);
     }
     $Session = new Session($storage, $bag);
     $Session->start();
     return $Session;
 }