當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Session::getSessionId方法代碼示例

本文整理匯總了PHP中Magento\Backend\Model\Auth\Session::getSessionId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Session::getSessionId方法的具體用法?PHP Session::getSessionId怎麽用?PHP Session::getSessionId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Backend\Model\Auth\Session的用法示例。


在下文中一共展示了Session::getSessionId方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testProcessProlong

 /**
  * Test of prolong user action
  *
  * @magentoDbIsolation enabled
  */
 public function testProcessProlong()
 {
     $this->auth->login(\Magento\TestFramework\Bootstrap::ADMIN_NAME, \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD);
     $sessionId = $this->authSession->getSessionId();
     $dateInPast = $this->dateTime->formatDate($this->authSession->getUpdatedAt() - 100);
     $this->adminSessionsManager->getCurrentSession()->setData('updated_at', $dateInPast)->save();
     $this->adminSessionInfo->load($sessionId, 'session_id');
     $oldUpdatedAt = $this->adminSessionInfo->getUpdatedAt();
     $this->authSession->prolong();
     $this->adminSessionInfo->load($sessionId, 'session_id');
     $updatedAt = $this->adminSessionInfo->getUpdatedAt();
     $this->assertGreaterThan($oldUpdatedAt, $updatedAt);
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:18,代碼來源:AuthSessionTest.php

示例2: getCollectionForLogoutOtherUserSessions

 /**
  * Collection getter with filters populated for testLogoutOtherUserSessions() method
  *
  * @param AdminSessionInfo $session
  * @return ResourceModel\AdminSessionInfo\Collection
  */
 protected function getCollectionForLogoutOtherUserSessions(\Magento\Security\Model\AdminSessionInfo $session)
 {
     /** @var \Magento\Security\Model\ResourceModel\AdminSessionInfo\Collection $collection */
     $collection = $session->getResourceCollection();
     $collection->filterByUser($this->authSession->getUser()->getId(), \Magento\Security\Model\AdminSessionInfo::LOGGED_IN, $this->authSession->getSessionId())->filterExpiredSessions(100)->load();
     return $collection;
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:13,代碼來源:AdminSessionsManagerTest.php

示例3: getSessionId

 /**
  * {@inheritdoc}
  */
 public function getSessionId()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getSessionId');
     if (!$pluginInfo) {
         return parent::getSessionId();
     } else {
         return $this->___callPlugins('getSessionId', func_get_args(), $pluginInfo);
     }
 }
開發者ID:dragonsword007008,項目名稱:magento2,代碼行數:12,代碼來源:Interceptor.php

示例4: createNewSession

 /**
  * Create new record
  *
  * @return $this
  */
 protected function createNewSession()
 {
     $this->adminSessionInfoFactory->create()->setData(['session_id' => $this->authSession->getSessionId(), 'user_id' => $this->authSession->getUser()->getId(), 'ip' => $this->remoteAddress->getRemoteAddress(), 'status' => AdminSessionInfo::LOGGED_IN])->save();
     return $this;
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:10,代碼來源:AdminSessionsManager.php


注:本文中的Magento\Backend\Model\Auth\Session::getSessionId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。