当前位置: 首页>>代码示例>>PHP>>正文


PHP Session::__construct方法代码示例

本文整理汇总了PHP中Symfony\Component\HttpFoundation\Session\Session::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::__construct方法的具体用法?PHP Session::__construct怎么用?PHP Session::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\HttpFoundation\Session\Session的用法示例。


在下文中一共展示了Session::__construct方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * {@inheritDoc}
  *
  * modified to set session cookie name dynamically so admin and storefront
  * cookies are separated. It should be closer to native session storage,
  * but it is not worth it to extend/modify another class yet.
  */
 public function __construct(SessionStorageInterface $storage = null, AttributeBagInterface $attributes = null, FlashBagInterface $flashes = null)
 {
     parent::__construct($storage, $attributes, $flashes);
     if (null !== ($context = Runtime::getContext())) {
         $this->storage->setOptions(array('name' => 'zm-' . $context));
     }
 }
开发者ID:zenmagick,项目名称:zenmagick,代码行数:14,代码来源:Session.php

示例2: __construct

 public function __construct(array $config = array())
 {
     $handler = isset($config['handler']) ? $config['handler'] : 'native';
     $config = isset($config['config']) ? $config['config'] : array();
     try {
         switch ($handler) {
             case "memcached":
                 $storage = $this->configureMemcachedHandler($config);
                 break;
             default:
                 $storage = new NativeSessionHandler();
                 break;
         }
     } catch (\Exception $e) {
         $storage = new NativeSessionHandler();
     }
     $storage = new MockArraySessionStorage();
     /*
     $storage = new NativeSessionStorage(array(
         "name"=> "hmmmm",
         "id"=> "hmmmm",
         "path"=> "/"
     ), $storage );
     */
     parent::__construct($storage);
 }
开发者ID:renegare,项目名称:skip_php_framework,代码行数:26,代码来源:SessionService.php

示例3: __construct

 /**
  * Constructor.
  *
  * @param SessionStorageInterface $storage    A SessionStorageInterface instance.
  * @param AttributeBagInterface   $attributes An AttributeBagInterface instance, (defaults null for default
  *                                            AttributeBag)
  * @param FlashBagInterface       $flashes    A FlashBagInterface instance (defaults null for default FlashBag)
  */
 public function __construct(SessionStorageInterface $storage = NULL, AttributeBagInterface $attributes = NULL, FlashBagInterface $flashes = NULL)
 {
     parent::__construct($storage, $attributes, $flashes);
     $errorsBag = new ErrorBag();
     $this->errorBagName = $errorsBag->getName();
     $this->registerBag($errorsBag);
 }
开发者ID:middleout,项目名称:arhitect-session,代码行数:15,代码来源:SymfonySession.php

示例4: __construct

 /**
  * Constructor.
  *
  * @param SessionStorageInterface $storage    			A SessionStorageInterface instance.
  * @param AttributeBagInterface   $attributes 			An AttributeBagInterface instance, (defaults null for default AttributeBag)
  * @param FlashBagInterface       $flashes    			A FlashBagInterface instance (defaults null for default FlashBag)
  * @param FlashBagInterface       $autoExpireFlashBag   A FlashBagInterface instance (defaults null for default FlashBag)
  */
 public function __construct(Application $app, SessionStorageInterface $storage = null, AttributeBagInterface $attributes = null, FlashBagInterface $flashes = null, FlashBagInterface $autoExpireFlashBag = null, $sTokenNamespace = 'csrf')
 {
     $this->app = $app;
     parent::__construct($storage, $attributes, $flashes);
     if (null === $autoExpireFlashBag) {
         $autoExpireFlashBag = new AutoExpireFlashBag();
     }
     $this->autoExpireFlashName = $autoExpireFlashBag->getName();
     $this->registerBag($autoExpireFlashBag);
     $this->start();
     $this->sTokenNamespace = $sTokenNamespace;
     $this->setToken();
 }
开发者ID:forxer,项目名称:tao,代码行数:21,代码来源:Session.php

示例5: __construct

 /**
  * @param SessionStorageInterface $storage
  */
 public function __construct(SessionStorageInterface $storage)
 {
     parent::__construct($storage);
 }
开发者ID:Tanklong,项目名称:openvj,代码行数:7,代码来源:UserSession.php

示例6: __construct

 public function __construct(ConfigBuilderInterface $config)
 {
     $this->config = $config;
     parent::__construct();
 }
开发者ID:kodazzi,项目名称:framework,代码行数:5,代码来源:SessionBuilder.php

示例7: __construct

 public function __construct()
 {
     $handle = new NativeFileSessionHandler(cache_path('session/'));
     $storage = new NativeSessionStorage(['use_cookies' => 0], $handle);
     parent::__construct($storage);
 }
开发者ID:leon723,项目名称:chestnut,代码行数:6,代码来源:Session.php

示例8: __construct

 public function __construct(SessionStorageInterface $storage, AttributeBagInterface $attributes, FlashBagInterface $flashes)
 {
     parent::__construct($storage, $attributes, $flashes);
 }
开发者ID:Rexota,项目名称:cdn-server,代码行数:4,代码来源:CoreSession.php

示例9: __construct

 /**
  * Session constructor.
  * @param array|String $options
  * ***********************************************************************************
  * #------------- [options] -------------#
  * List of options for $options array with their defaults.
  *
  * @see http://php.net/session.configuration for options
  * but we omit 'session.' from the beginning of the keys for convenience.
  *
  * ("auto_start", is not supported as it tells PHP to start a session before
  * PHP starts to execute user-land code. Setting during runtime has no effect).
  *
  * cache_limiter, "" (use "0" to prevent headers from being sent entirely).
  * cookie_domain, ""
  * cookie_httponly, ""
  * cookie_lifetime, "0"
  * cookie_path, "/"
  * cookie_secure, ""
  * entropy_file, ""
  * entropy_length, "0"
  * gc_divisor, "100"
  * gc_maxlifetime, "1440"
  * gc_probability, "1"
  * hash_bits_per_character, "4"
  * hash_function, "0"
  * name, "PHPSESSID"
  * referer_check, ""
  * serialize_handler, "php"
  * use_cookies, "1"
  * use_only_cookies, "1"
  * use_trans_sid, "0"
  * upload_progress.enabled, "1"
  * upload_progress.cleanup, "1"
  * upload_progress.prefix, "upload_progress_"
  * upload_progress.name, "PHP_SESSION_UPLOAD_PROGRESS"
  * upload_progress.freq, "1%"
  * upload_progress.min-freq, "1"
  * url_rewriter.tags, "a=href,area=href,frame=src,form=,fieldset="
  *
  *
  * #------------- [handler] -------------#
  * prefix, "sid_"
  * expiretime, 86400
  * ***********************************************************************************
  *
  * @param boolean $createNew Create new session id, destroy old session from cookie and storage.
  * @param null|String $driver
  * @param null|string $driverConfig
  */
 public function __construct($options, $createNew = false, $driver = null, $driverConfig = null)
 {
     is_string($options) && ($options = config($options));
     $options = $options ?: config(env("SESSION_DEFAULT_OPTIONS"));
     if (!$options || !$options['handler'] || !$options['options']) {
         throw new \RuntimeException("Invalid options: " . var_export($options, true));
     }
     $driver = $driver ?: env("SESSION_DRIVER", 'file');
     $driverConfig = $driverConfig ?: env("SESSION_DRIVER_CONFIG");
     $optionsHandler = $options['handler'];
     switch ($driver = strtolower($driver)) {
         case 'redis':
         case 'predis':
         case 'memcache':
         case 'memcached':
         case 'mongodb':
         case 'mongo':
         case 'pdo':
         case 'file':
             $handler = call_user_func_array([$this, "{$driver}SessionHandler"], [$driverConfig, $optionsHandler]);
             break;
         default:
             throw new \RuntimeException("The session driver not support.");
             break;
     }
     $optionsStorage = $options['options'];
     $storage = new NativeSessionStorage($optionsStorage, $handler);
     $attributes = new AttributeBag("_ips_attributes");
     if ($createNew) {
         $session_name = isset($options['options']['name']) ? $options['options']['name'] : "PHPSESSID";
         if (isset($_COOKIE[$session_name])) {
             $old_session_id = $_COOKIE[$session_name];
             $_COOKIE[$session_name] = null;
             @$storage->getSaveHandler()->destroy($old_session_id);
         }
     }
     parent::__construct($storage, $attributes);
 }
开发者ID:impress-php,项目名称:framework,代码行数:88,代码来源:Session.php

示例10: __construct

 /**
  * {@inheritDoc}
  */
 public function __construct(SessionStorageInterface $storage = null, AttributeBagInterface $attributes = null, FlashBagInterface $flashes = null, ConversationBag $conversations = null)
 {
     parent::__construct($storage, $attributes, $flashes);
     $this->conversationName = $conversations->getName();
     $this->registerBag($conversations);
 }
开发者ID:iteman,项目名称:pageflower-bundle,代码行数:9,代码来源:ConversationalSession.php


注:本文中的Symfony\Component\HttpFoundation\Session\Session::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。