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


PHP Container::setExpirationSeconds方法代码示例

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


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

示例1: __construct

 public function __construct($requestParams, $translate)
 {
     $this->request = $requestParams;
     $this->translate = $translate;
     $sessionNamespace = new SessionContainer('globalRoute');
     $sessionNamespace->setExpirationSeconds(3600);
     $this->sessionAdapter = $sessionNamespace;
 }
开发者ID:cityware,项目名称:city-datagrid,代码行数:8,代码来源:DatagridDb.php

示例2: testKeyExistsWithContainerExpirationInPastWithSetExpirationSecondsReturnsFalse

 public function testKeyExistsWithContainerExpirationInPastWithSetExpirationSecondsReturnsFalse()
 {
     $this->container->foo = 'bar';
     $storage = $this->manager->getStorage();
     $storage->setMetadata('Default', array('EXPIRE' => $_SERVER['REQUEST_TIME'] - 18600));
     $this->container->setExpirationSeconds(1);
     $this->assertFalse(isset($this->container->foo));
 }
开发者ID:haoyanfei,项目名称:zf2,代码行数:8,代码来源:ContainerTest.php

示例3: index04Action

 public function index04Action()
 {
     $ssUser = new Container("user");
     //$ssUser->offsetSet("fullname" , "trong handsome");
     echo $ssUser->offsetGet("fullname");
     $ssUser->setExpirationSeconds(5, array("fullname"));
     return false;
 }
开发者ID:trongle,项目名称:zend-2,代码行数:8,代码来源:SessionController.php

示例4: checkAuthentication

 public function checkAuthentication($page_url)
 {
     $session = new Container('base');
     if (!$session->offsetExists('logged_in') || $session->offsetGet('logged_in') !== true) {
         return $this->redirect()->toRoute('employee', array('action' => 'signin', 'controller' => 'employee'));
     }
     $session->setExpirationSeconds(28800);
     return true;
 }
开发者ID:DEVOP-TEAM,项目名称:3.0-Zend,代码行数:9,代码来源:AbstractActionUnitedwebdesignsController.php

示例5: getSession

 /**
  * Get session object
  *
  * @throws Exception\InvalidArgumentException
  * @return Container
  */
 public function getSession()
 {
     if (!isset($this->session) || null === $this->session) {
         $id = $this->getId();
         if (!class_exists($this->sessionClass)) {
             throw new Exception\InvalidArgumentException("Session class {$this->sessionClass} not found");
         }
         $this->session = new $this->sessionClass('Zend_Form_Captcha_' . $id);
         $this->session->setExpirationHops(1, null);
         $this->session->setExpirationSeconds($this->getTimeout());
     }
     return $this->session;
 }
开发者ID:zendframework,项目名称:zend-captcha,代码行数:19,代码来源:AbstractWord.php

示例6: getSession

 /**
  * Get session object
  *
  * @return \Zend\Session\Container
  */
 public function getSession()
 {
     if (!isset($this->_session) || null === $this->_session) {
         $id = $this->getId();
         if (!class_exists($this->_sessionClass)) {
             \Zend\Loader::loadClass($this->_sessionClass);
         }
         $this->_session = new $this->_sessionClass('Zend_Form_Captcha_' . $id);
         $this->_session->setExpirationHops(1, null, true);
         $this->_session->setExpirationSeconds($this->getTimeout());
     }
     return $this->_session;
 }
开发者ID:navtis,项目名称:xerxes-pazpar2,代码行数:18,代码来源:Word.php

示例7: authenticate

 /**
  * Performs an authentication attempt
  *
  * @return \Zend\Authentication\Result
  * @throws \Zend\Authentication\Adapter\Exception\ExceptionInterface
  *               If authentication cannot be performed
  */
 public function authenticate()
 {
     $result = ApiClient::authenticate(array('username' => $this->username, 'password' => $this->password));
     if (array_key_exists('access_token', $result) && !empty($result['access_token'])) {
         $hydrator = new ClassMethods();
         $user = $hydrator->hydrate(ApiClient::getUser($this->username), new User());
         $session = new Container('oauth_session');
         $session->setExpirationSeconds($result['expires_in']);
         $session->accessToken = $result['access_token'];
         $response = new Result(Result::SUCCESS, $user, array('Authentication successful.'));
     } else {
         $response = new Result(Result::FAILURE, NULL, array('Invalid credentials.'));
     }
     return $response;
 }
开发者ID:CPDeutschland,项目名称:zf2-api-client,代码行数:22,代码来源:Api.php

示例8: ingresoAction

 /**
  * Metodo para validar acceso al portal
  * @return \Zend\View\Model\ViewModel
  */
 public function ingresoAction()
 {
     if ($this->getRequest()->isPost()) {
         $auth = new AuthenticationService();
         $validate = $this->getRequest()->getPost();
         $authAdapter = new AuthAdapter($this->adapter(), 'usuario', 'usuario_correo', 'usuario_password');
         $authAdapter->setIdentity($validate['correo']);
         $authAdapter->setCredential(md5($validate['password']));
         $resultado = $auth->authenticate($authAdapter);
         switch ($resultado->getCode()) {
             case Result::FAILURE_IDENTITY_NOT_FOUND:
                 $this->message = "Usuario y/o contraseña incorrectos";
                 $this->flashMessenger()->addMessage($this->message);
                 return $this->redirect()->toUrl($this->getRequest()->getBaseUrl() . '/login');
             case Result::FAILURE_CREDENTIAL_INVALID:
                 $this->message = "Usuario y/o contraseña incorrectos";
                 $this->flashMessenger()->addMessage($this->message);
                 return $this->redirect()->toUrl($this->getRequest()->getBaseUrl() . '/login');
             case Result::SUCCESS:
                 $this->flashMessenger()->clearMessages();
                 $store = $auth->getStorage();
                 $store->write($authAdapter->getResultRowObject(null, 'usuario_password'));
                 $sessionConfig = new StandardConfig();
                 $sessionConfig->setRememberMeSeconds(20)->setCookieLifetime(30)->setCookieSecure(true)->setGcMaxlifetime(60)->setGcDivisor(60);
                 $sesionMa = new SessionManager($sessionConfig);
                 $sesionMa->rememberMe(30);
                 $container = new Container('cbol');
                 $container->setExpirationSeconds(1800);
                 $sesionMa->start();
                 $container->idSession = $auth->getIdentity()->perfil_id;
                 $permisos = $this->getPermisos($auth->getIdentity()->usuario_id);
                 $container->permisosUser = $permisos;
                 $indexProfile = \Login\IndexAllProfile::listIndexAllProfiles($auth->getIdentity()->perfil_id);
                 if ($indexProfile == 'vias') {
                     $container->reportesVias = $this->getReportesViales();
                 }
                 if ($indexProfile == 'admin') {
                     $container->sugerencias = $this->getSugerenciasAction();
                 }
                 $container->setDefaultManager($sesionMa);
                 return $this->redirect()->toUrl($this->getRequest()->getBaseUrl() . "/{$indexProfile}");
             default:
                 echo 'Mensaje por defecto';
                 break;
         }
     }
 }
开发者ID:nathalysalamanca,项目名称:Observatorio,代码行数:51,代码来源:LoginController.php

示例9: orderAction

 public function orderAction()
 {
     $bookID = $this->_mainParam['data']['id'];
     $price = $this->_mainParam['data']['price'];
     $qty = $this->_mainParam['data']['qty'];
     $ssOrder = new Container(BOOKONLINE_KEY . "_order");
     $ssOrder->setExpirationSeconds(600);
     if (empty($ssOrder->qty)) {
         $ssOrder->price = array($bookID => $price * $qty);
         $ssOrder->qty = array($bookID => $qty);
     } else {
         if ($ssOrder->qty[$bookID] > 0) {
             $ssOrder->qty[$bookID] += $qty;
             $ssOrder->price[$bookID] = $price * $ssOrder->qty[$bookID];
         } else {
             $ssOrder->qty[$bookID] = $qty;
             $ssOrder->price[$bookID] = $price * $qty;
         }
     }
     $linkViewCart = $this->getServiceLocator()->get('ViewHelperManager')->get('linkViewCart');
     return $this->redirect()->toUrl($linkViewCart());
 }
开发者ID:trongle,项目名称:book_zend2,代码行数:22,代码来源:UserController.php

示例10: __construct

 public function __construct()
 {
     $sessionRoute = new \Zend\Session\Container('globalRoute');
     $sessionRoute->setExpirationSeconds(3600);
     $this->aSession = $sessionRoute->getArrayCopy();
 }
开发者ID:cityware,项目名称:city-db,代码行数:6,代码来源:Zend.php

示例11: bootstrapSession

 public function bootstrapSession($e)
 {
     if (\Zend\Console\Console::isConsole()) {
         return;
     }
     $session = $e->getApplication()->getServiceManager()->get('Zend\\Session\\SessionManager');
     $session->start();
     #error_log(var_export($_SESSION, true));
     $container = new Container('initialized');
     if (!isset($container->init)) {
         error_log('initializing session');
         $serviceManager = $e->getApplication()->getServiceManager();
         $request = $serviceManager->get('Request');
         $session->regenerateId(true);
         $container->init = 1;
         $container->remoteAddr = $request->getServer()->get('REMOTE_ADDR');
         $container->httpUserAgent = $request->getServer()->get('HTTP_USER_AGENT');
         $config = $serviceManager->get('Config');
         if (!isset($config['session'])) {
             return;
         }
         $sessionConfig = $config['session'];
         if (isset($sessionConfig['validators'])) {
             $chain = $session->getValidatorChain();
             foreach ($sessionConfig['validators'] as $validator) {
                 switch ($validator) {
                     case 'Zend\\Session\\Validator\\HttpUserAgent':
                         $validator = new $validator($container->httpUserAgent);
                         break;
                     case 'Zend\\Session\\Validator\\RemoteAddr':
                         $validator = new $validator($container->remoteAddr);
                         break;
                     default:
                         $validator = new $validator();
                 }
                 $chain->attach('session.validate', array($validator, 'isValid'));
             }
         }
     }
     $expiration_time = 3600;
     $container->setExpirationSeconds($expiration_time, 'initialized');
     if (!$session->isValid()) {
         error_log('Session is not valid');
         $container->init = 0;
     }
     #$container->getManager()->getStorage()->clear('initialized');
     if (!isset($container->init) || $container->lifetime < time()) {
         error_log('reset session due to expiration');
         $container->getManager()->getStorage()->clear('initialized');
         $container = new Container('initialized');
         $container->init = 1;
         $container->lifetime = time() + $expiration_time;
         $container->checkout = array();
         $container->getManager()->getStorage()->clear('cart');
     } else {
         $container->lifetime = time() + $expiration_time;
     }
     #$cartContainer->getManager()->getStorage()->clear('cart');
     #$cartContainer->init = 0;
     /*if(!isset($cartContainer->init) || $cartContainer->init != 1) {
           #error_log('reset cart');
           $cartContainer->getManager()->getStorage()->clear('cart');
           
           $app = $e->getApplication();
           $serviceManager = $app->getServiceManager();
           $em = $serviceManager->get('Doctrine\ORM\EntityManager');
           
           $code = new Entity\Code();
           $code->genCode();
           $order = new Entity\Order();
           $order->setCode($code);
           $em->persist($order);
           $em->flush();
           
           $cartContainer->order_id = $order->getId();
           #$cartContainer->order = new Entity\Order();
           $cartContainer->init = 1;
       }*/
     /*$cartContainer->chooserCount--;
       if($cartContainer->chooserCount <= 0) {
           $cartContainer->chooser = false;
       }*/
     /*
      * shopping cart debugging
      */
     /*error_log('=== Order Info ===');
       error_log('paymenttype_id: '.$cartContainer->order->getPaymentTypeId());
       error_log('buyer_id: '.$cartContainer->order->getBuyerId());
       $buyer = $cartContainer->order->getBuyer();
       if($buyer) {
           error_log('buyer email: '.$cartContainer->order->getBuyer()->getEmail());
       }
       foreach($cartContainer->order->getPackages() as $package) {
           error_log('  --- Package Info ---');
           error_log('  participant_id: '.$package->getParticipantId());
           $items = $package->getItems();
           foreach($items as $item) {
               error_log(' - '.$item->getName().' (Product_id: '.$item->getProductId().')');
           }
           error_log('  --------------------');
//.........这里部分代码省略.........
开发者ID:odegroot,项目名称:ers,代码行数:101,代码来源:Module.php

示例12: getSessionAdapter

 /**
  * Retorna o adaptador de sessao
  * @param string $name
  * @return SessionContainer
  */
 public function getSessionAdapter($name = 'Default')
 {
     if (!isset($_SESSION[$name])) {
         $sessionConfig = new SessionConfig();
         $sessionConfig->setOptions($this->globalConfig['session']);
         $sessionStorage = new \Zend\Session\Storage\SessionArrayStorage();
         $sessionManager = new SessionManager();
         $sessionManager->rememberMe($this->globalConfig['session']['remember_me_seconds']);
         $sessionManager->forgetMe();
         $sessionManager->setConfig($sessionConfig);
         $sessionManager->setStorage($sessionStorage);
         $sessionNamespace = new SessionContainer($name, $sessionManager);
         $sessionNamespace->setExpirationSeconds(3600);
         if (!isset($sessionNamespace->init)) {
             $request = new \Zend\Http\PhpEnvironment\Request();
             $sessionNamespace->init = 1;
             $sessionNamespace->remoteAddr = $request->getServer('REMOTE_ADDR');
             $sessionNamespace->httpUserAgent = $request->getServer('HTTP_USER_AGENT');
             /*
              $chain = $sessionManager->getValidatorChain();
              $validatorUserAgent = new \Zend\Session\Validator\HttpUserAgent($sessionNamespace->httpUserAgent);
              $chain->attach('session.validate', array($validatorUserAgent, 'isValid'));
              $validatorAddr = new \Zend\Session\Validator\RemoteAddr($sessionNamespace->remoteAddr);
              $chain->attach('session.validate', array($validatorAddr, 'isValid'));
             
              $sessionManager->setValidatorChain($chain);
             * 
             */
         }
         $sessionNamespace->setDefaultManager($sessionManager);
     } else {
         $sessionNamespace = new SessionContainer($name);
         $sessionNamespace->setExpirationSeconds(3600);
     }
     $this->sessionAdapter = $sessionNamespace;
     return $sessionNamespace;
 }
开发者ID:fsvxavier,项目名称:cityware,代码行数:42,代码来源:AbstractActionController.php


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