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


PHP SessionManager::writeClose方法代碼示例

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


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

示例1: __invoke

 public function __invoke(AuthenticationEvent $e)
 {
     $result = $e->getResult();
     if ($result->isValid()) {
         $this->sessionManager->writeClose();
     }
 }
開發者ID:t4web,項目名稱:authentication,代碼行數:7,代碼來源:SessionWrite.php

示例2: disableWrite

 /**
  * Disable session writes after this point in time.
  *
  * @return void
  */
 public function disableWrite()
 {
     // Set the flag
     $this->disableWrite = true;
     // If the session manager is already instantiated, close it!
     if (null !== $this->manager) {
         $this->manager->writeClose();
     }
 }
開發者ID:bbeckman,項目名稱:NDL-VuFind2,代碼行數:14,代碼來源:Settings.php

示例3: authListener

 /**
  * @param AuthenticationEvent $e
  */
 public function authListener(AuthenticationEvent $e)
 {
     $result = $e->getResult();
     if ($result->isValid()) {
         if ($this->rememberMe) {
             $this->sessionManager->rememberMe();
         } else {
             $this->sessionManager->forgetMe();
         }
         $this->sessionManager->writeClose();
     }
 }
開發者ID:leogr,項目名稱:zf2-auth-module,代碼行數:15,代碼來源:InteractiveAuth.php

示例4: userAuthentication

 protected function userAuthentication($data)
 {
     $auth = $this->authService;
     $adapter = $auth->getAdapter();
     $adapter->setIdentityValue($data['username']);
     $adapter->setCredentialValue($data['password']);
     $authResult = $auth->authenticate();
     if ($authResult->isValid()) {
         $identity = $authResult->getIdentity();
         $auth->getStorage()->write($identity);
         $sessionManager = new SessionManager();
         if ($data['rememberme']) {
             $sessionManager->rememberMe();
         }
         // store user roles in a session container
         $userContainer = new Container('User');
         $userContainer->offsetSet('id', $identity->getUserId());
         $userRoles = $identity->getRole()->toArray();
         $roleNames = array();
         foreach ($userRoles as $userRole) {
             $roleNames[] = $userRole->getRoleName();
         }
         $userContainer->offsetSet('activeRole', $roleNames[0]);
         $userContainer->offsetSet('allRoles', $roleNames);
         $sessionManager->writeClose();
         return true;
     }
     return false;
 }
開發者ID:CATSInformatica,項目名稱:CatsSys,代碼行數:29,代碼來源:LoginController.php

示例5: writeClose

 /**
  * Write session to save handler and close
  *
  * Once done, the Storage object will be marked as isImmutable.
  *
  * @return void
  */
 public function writeClose()
 {
     // Skip storage writing if validation is failed
     if (!$this->isValid()) {
         //$this->destroy();
         return;
     }
     // Set metadata for validators
     $storage = $this->getStorage();
     if (!$storage->isImmutable() && $this->validators) {
         $storage->setMetaData('_VALID', $this->validators);
     }
     parent::writeClose();
 }
開發者ID:Andyyang1981,項目名稱:pi,代碼行數:21,代碼來源:SessionManager.php

示例6: registerShutdownFunction

 /**
  * According to the PHP manual, session_write_close should always be
  * registered as a shutdown function when using an object as a session
  * handler: http://us.php.net/manual/en/function.session-set-save-handler.php
  *
  * This method sets that up.
  *
  * @param SessionManager $sessionManager Session manager instance
  *
  * @return void
  */
 protected function registerShutdownFunction(SessionManager $sessionManager)
 {
     register_shutdown_function(function () use($sessionManager) {
         // If storage is immutable, the session is already closed:
         if (!$sessionManager->getStorage()->isImmutable()) {
             $sessionManager->writeClose();
         }
     });
 }
開發者ID:bbeckman,項目名稱:NDL-VuFind2,代碼行數:20,代碼來源:ManagerFactory.php


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