当前位置: 首页>>代码示例>>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;未经允许,请勿转载。