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


PHP SessionManagerInterface::getSessionId方法代码示例

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


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

示例1: testSetSessionIdFromParam

 /**
  * @magentoConfigFixture current_store web/session/use_frontend_sid 1
  */
 public function testSetSessionIdFromParam()
 {
     $this->assertNotEquals('test_id', $this->_model->getSessionId());
     $_GET[$this->_sidResolver->getSessionIdQueryParam($this->_model)] = 'test-id';
     $this->_model->setSessionId($this->_sidResolver->getSid($this->_model));
     $this->assertEquals('test-id', $this->_model->getSessionId());
     /* Use not valid identifier */
     $_GET[$this->_sidResolver->getSessionIdQueryParam($this->_model)] = 'test_id';
     $this->_model->setSessionId($this->_sidResolver->getSid($this->_model));
     $this->assertEquals('test-id', $this->_model->getSessionId());
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:14,代码来源:SessionManagerTest.php

示例2: getSafeSessionId

 /**
  * Get a hash of the session id.
  *
  * @return string|null
  */
 protected function getSafeSessionId()
 {
     if (!$this->safeSessionId) {
         // When there is no session id, safeSessionId will be set to null.
         // This will prevent the method call from getting cached (above
         // check will fail) and cause the session to be rechecked for a
         // session id on successive calls until a session id is retrieved.
         // Allowing this behavior in case a log call happens before the
         // session is started. Some calls may miss the session id but once
         // it is available, it will be retrieved, cached and attached to
         // later log calls.
         $sessionId = $this->session->getSessionId();
         $this->safeSessionId = $sessionId ? hash('sha256', $this->session->getSessionId()) : null;
     }
     return $this->safeSessionId;
 }
开发者ID:eBayEnterprise,项目名称:magento2-retail-order-management,代码行数:21,代码来源:LoggerContext.php

示例3: updatePathParams

 /**
  * {@inheritdoc}
  *
  * @param array $arguments
  * @return array
  */
 public function updatePathParams(array $arguments)
 {
     if ($this->_session->getCookieShouldBeReceived() && $this->_sidResolver->getUseSessionInUrl() && $this->_canUseSessionIdInParam) {
         $arguments += ['_query' => [$this->_sidResolver->getSessionIdQueryParam($this->_session) => $this->_session->getSessionId()]];
     }
     return $arguments;
 }
开发者ID:nja78,项目名称:magento2,代码行数:13,代码来源:Redirect.php

示例4: redirect

 /**
  * Set redirect into response
  *
  * @param \Magento\Framework\App\ResponseInterface $response
  * @param string $path
  * @param array $arguments
  * @return void
  */
 public function redirect(\Magento\Framework\App\ResponseInterface $response, $path, $arguments = array())
 {
     if ($this->_session->getCookieShouldBeReceived() && $this->_urlBuilder->getUseSession() && $this->_canUseSessionIdInParam) {
         $arguments += array('_query' => array($this->_sidResolver->getSessionIdQueryParam($this->_session) => $this->_session->getSessionId()));
     }
     $response->setRedirect($this->_urlBuilder->getUrl($path, $arguments));
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:15,代码来源:Redirect.php

示例5: _saveCache

 /**
  * Save block content to cache storage
  *
  * @param string $data
  * @return $this
  */
 protected function _saveCache($data)
 {
     if ($this->getCacheLifetime() === null || !$this->_cacheState->isEnabled(self::CACHE_GROUP)) {
         return false;
     }
     $cacheKey = $this->getCacheKey();
     $data = str_replace($this->_sidResolver->getSessionIdQueryParam($this->_session) . '=' . $this->_session->getSessionId(), $this->_getSidPlaceholder($cacheKey), $data);
     $this->_cache->save($data, $cacheKey, $this->getCacheTags(), $this->getCacheLifetime());
     return $this;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:16,代码来源:AbstractBlock.php

示例6: initByRequest

 /**
  * Initialization visitor by request
  *
  * Used in event "controller_action_predispatch"
  *
  * @param   \Magento\Framework\Event\Observer $observer
  * @return  \Magento\Customer\Model\Visitor
  */
 public function initByRequest($observer)
 {
     if ($this->skipRequestLogging || $this->isModuleIgnored($observer)) {
         return $this;
     }
     if ($this->session->getVisitorData()) {
         $this->setData($this->session->getVisitorData());
     }
     if (!$this->getId()) {
         $this->setSessionId($this->session->getSessionId());
         $this->save();
         $this->_eventManager->dispatch('visitor_init', array('visitor' => $this));
         $this->session->setVisitorData($this->getData());
     }
     return $this;
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:24,代码来源:Visitor.php

示例7: initByRequest

 /**
  * Initialization visitor by request
  *
  * Used in event "controller_action_predispatch"
  *
  * @param   \Magento\Framework\Event\Observer $observer
  * @return  \Magento\Customer\Model\Visitor
  */
 public function initByRequest($observer)
 {
     if ($this->skipRequestLogging || $this->isModuleIgnored($observer)) {
         return $this;
     }
     if ($this->session->getVisitorData()) {
         $this->setData($this->session->getVisitorData());
     }
     $this->setLastVisitAt((new \DateTime())->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT));
     if (!$this->getId()) {
         $this->setSessionId($this->session->getSessionId());
         $this->save();
         $this->_eventManager->dispatch('visitor_init', ['visitor' => $this]);
         $this->session->setVisitorData($this->getData());
     }
     return $this;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:25,代码来源:Visitor.php


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