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


PHP Storage\MetadataBag类代码示例

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


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

示例1: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->bag = new MetadataBag();
     $this->array = array(MetadataBag::CREATED => 1234567, MetadataBag::UPDATED => 12345678, MetadataBag::LIFETIME => 0);
     $this->bag->initialize($this->array);
 }
开发者ID:saj696,项目名称:pipe,代码行数:7,代码来源:MetadataBagTest.php

示例2: testDoesNotSkipLastUsedUpdate

 public function testDoesNotSkipLastUsedUpdate()
 {
     $bag = new MetadataBag('', 30);
     $timeStamp = time();
     $created = $timeStamp - 45;
     $sessionMetadata = array(MetadataBag::CREATED => $created, MetadataBag::UPDATED => $created, MetadataBag::LIFETIME => 1000);
     $bag->initialize($sessionMetadata);
     $this->assertEquals($timeStamp, $sessionMetadata[MetadataBag::UPDATED]);
 }
开发者ID:neteasy-work,项目名称:hkgbf_crm,代码行数:9,代码来源:MetadataBagTest.php

示例3: clear

 public function clear()
 {
     if ($this->metadataBag) {
         $this->metadataBag->clear();
     }
     foreach ($this->bags as $bag) {
         $bag->clear();
     }
 }
开发者ID:adon988,项目名称:phpsocket.io,代码行数:9,代码来源:AbstractStorage.php

示例4: regenerate

 /**
  * {@inheritdoc}
  */
 public function regenerate($destroy = false, $lifetime = null)
 {
     if (!$this->started) {
         $this->start();
     }
     $this->metadataBag->stampNew($lifetime);
     $this->id = $this->generateId();
     return true;
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:12,代码来源:MockArraySessionStorage.php

示例5: regenerate

 /**
  * {@inheritdoc}
  */
 public function regenerate($destroy = false, $lifetime = null)
 {
     if (null !== $lifetime) {
         ini_set('session.cookie_lifetime', $lifetime);
     }
     if ($destroy) {
         $this->metadataBag->stampNew();
     }
     return session_regenerate_id($destroy);
 }
开发者ID:rodionrakib,项目名称:twig,代码行数:13,代码来源:NativeSessionStorage.php

示例6: regenerate

 /**
  * {@inheritdoc}
  */
 public function regenerate($destroy = false, $lifetime = null)
 {
     if (null !== $lifetime) {
         ini_set('session.cookie_lifetime', $lifetime);
     }
     if ($destroy) {
         $this->metadataBag->stampNew();
     }
     $isRegenerated = session_regenerate_id($destroy);
     // The reference to $_SESSION in session bags is lost in PHP7 and we need to re-create it.
     // @see https://bugs.php.net/bug.php?id=70013
     $this->loadSession();
     return $isRegenerated;
 }
开发者ID:hichammoad,项目名称:symfony,代码行数:17,代码来源:NativeSessionStorage.php

示例7: regenerate

 /**
  * {@inheritdoc}
  */
 public function regenerate($destroy = false, $lifetime = null)
 {
     if (!$this->started) {
         $this->start();
     }
     if ($lifetime !== null) {
         $this->options['cookie_lifetime'] = $lifetime;
     }
     if ($destroy) {
         $this->metadataBag->stampNew($lifetime);
         $this->handler->destroy($this->id);
     }
     $this->id = $this->generator->generateId();
     return true;
 }
开发者ID:atiarda,项目名称:bolt,代码行数:18,代码来源:SessionStorage.php

示例8: regenerate

 /**
  * {@inheritdoc}
  */
 public function regenerate($destroy = false, $lifetime = null)
 {
     if (null !== $lifetime) {
         ini_set('session.cookie_lifetime', $lifetime);
     }
     if ($destroy) {
         $this->metadataBag->stampNew();
     }
     $ret = session_regenerate_id($destroy);
     // workaround for https://bugs.php.net/bug.php?id=61470 as suggested by David Grudl
     session_write_close();
     $backup = $_SESSION;
     session_start();
     $_SESSION = $backup;
     return $ret;
 }
开发者ID:trangunghoa,项目名称:l4cms,代码行数:19,代码来源:NativeSessionStorage.php

示例9: regenerate

 /**
  * {@inheritdoc}
  */
 public function regenerate($destroy = false, $lifetime = null)
 {
     if (!$this->started) {
         $this->start();
     }
     if ($lifetime !== null) {
         $this->options['cookie_lifetime'] = $lifetime;
     }
     if ($destroy) {
         $this->metadataBag->stampNew($lifetime);
         $this->handler->destroy($this->id);
     } else {
         $this->write();
     }
     $this->handler->close();
     $this->id = $this->generator->generateId();
     $this->handler->open(null, $this->name);
     // read is required to make new session data at this point
     $this->handler->read($this->id);
     return true;
 }
开发者ID:robbert-vdh,项目名称:bolt,代码行数:24,代码来源:SessionStorage.php

示例10: regenerate

 /**
  * {@inheritdoc}
  */
 public function regenerate($destroy = false, $lifetime = null)
 {
     // Cannot regenerate the session ID for non-active sessions.
     if (PHP_VERSION_ID >= 50400 && \PHP_SESSION_ACTIVE !== session_status()) {
         return false;
     }
     // Check if session ID exists in PHP 5.3
     if (PHP_VERSION_ID < 50400 && '' === session_id()) {
         return false;
     }
     if (null !== $lifetime) {
         ini_set('session.cookie_lifetime', $lifetime);
     }
     if ($destroy) {
         $this->metadataBag->stampNew();
     }
     $isRegenerated = session_regenerate_id($destroy);
     // The reference to $_SESSION in session bags is lost in PHP7 and we need to re-create it.
     // @see https://bugs.php.net/bug.php?id=70013
     $this->loadSession();
     return $isRegenerated;
 }
开发者ID:qasem2rubik,项目名称:laravel,代码行数:25,代码来源:NativeSessionStorage.php

示例11: regenerate

 /**
  * {@inheritdoc}
  */
 public function regenerate($destroy = false, $lifetime = null)
 {
     if (null !== $lifetime) {
         ini_set('session.cookie_lifetime', $lifetime);
     }
     if ($destroy) {
         $this->metadataBag->stampNew();
     }
     $ret = session_regenerate_id($destroy);
     // workaround for https://bugs.php.net/bug.php?id=61470 as suggested by David Grudl
     if ('files' === $this->getSaveHandler()->getSaveHandlerName()) {
         session_write_close();
         if (isset($_SESSION)) {
             $backup = $_SESSION;
             session_start();
             $_SESSION = $backup;
         } else {
             session_start();
         }
         $this->loadSession();
     }
     return $ret;
 }
开发者ID:senthil-r-wiredelta,项目名称:meilleure-visite,代码行数:26,代码来源:NativeSessionStorage.php

示例12: testClear

 public function testClear()
 {
     $this->bag->clear();
 }
开发者ID:laubosslink,项目名称:lab,代码行数:4,代码来源:MetadataBagTest.php

示例13: __construct

 /**
  * Constructs a new metadata bag instance.
  *
  * @param \Drupal\Core\Site\Settings $settings
  *   The settings instance.
  */
 public function __construct(Settings $settings)
 {
     $update_threshold = $settings->get('session_write_interval', 180);
     parent::__construct('_sf2_meta', $update_threshold);
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:11,代码来源:MetadataBag.php


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