當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。