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


PHP Zend_Session::getIterator方法代碼示例

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


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

示例1: tearDown

 public function tearDown()
 {
     if (isset($this->savePath)) {
         Zend_Session::setOptions(array('save_path' => $this->savePath));
         unset($this->savePath);
     }
     $old = error_reporting(E_ALL | E_STRICT);
     $this->assertTrue($old === error_reporting(E_ALL | E_STRICT), 'something associated with a particular test altered error_reporting to something other than E_STRICT');
     restore_error_handler();
     Zend_Session_Namespace::unlockAll();
     // @todo: cleanup
     if (count($this->error_list)) {
         echo "**** Errors: ";
         print_r($this->error_list);
     }
     // unset all namespaces
     foreach (Zend_Session::getIterator() as $space) {
         try {
             Zend_Session::namespaceUnset($space);
         } catch (Zend_Session_Exception $e) {
             $this->assertRegexp('/read.only/i', $e->getMessage());
             return;
         }
     }
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:25,代碼來源:SessionTest.php

示例2: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     /**
      * Pegando o helper Redirector
      */
     $this->_redirect = Zend_Controller_Action_HelperBroker::getStaticHelper('Redirector');
     /*
      * Instanciando as variáveis de sessão do zend_auth
      */
     $authNamespace = new Zend_Session_Namespace('Zend_Auth');
     /**
      * Copiando em variáves o modulo, controlle e action
      */
     $module = strtolower($request->getModuleName());
     $controller = strtolower($request->getControllerName());
     $action = strtolower($request->getActionName());
     /**
      * Se o usuário estiver autenticado
      */
     if (Zend_Auth::getInstance()->hasIdentity()) {
         if (isset($authNamespace->timeout) && time() > $authNamespace->timeout) {
             /**
              * limpa a identidade do usuário que está um longo período sem acessar o controller
              */
             $request->setModuleName('default');
             $request->setControllerName('login');
             $request->setActionName('logout');
             $authNamespace->erro = 'Sua sessão expirou, favor logar novamente';
         } else {
             /**
              *  Usuário está ativo - atualizamos o time da sessão.
              */
             $authNamespace->timeout = strtotime(self::$_ZEND_SESSION_NAMESPACE_EXPIRATION_SECONDS . " seconds");
             /**
              * Renovando o timeout das variáves de sessão
              */
             $namesspaces = Zend_Session::getIterator();
             $namesspacesArrayCopy = $namesspaces->getArrayCopy();
             foreach ($namesspacesArrayCopy as $namesspace) {
                 $namesspace_each = new Zend_Session_Namespace($namesspace);
                 //$namesspace_each->setExpirationSeconds(self::$_ZEND_SESSION_NAMESPACE_EXPIRATION_SECONDS);
                 $namesspace_each->timeout = strtotime(self::$_ZEND_SESSION_NAMESPACE_EXPIRATION_SECONDS . " seconds");
                 $temp = $namesspace_each->timeout;
             }
         }
     }
     /** Se o usuário não possuir identidade ou a identidade foi removida devido ao timeout,
      * redirecionamos ele para a tela de login.
      */
     if (!Zend_Auth::getInstance()->hasIdentity()) {
         if (!($module == 'default' && $controller == 'login' && $action == 'index') && !($module == 'default' && $controller == 'login' && $action == 'ajaxbanco')) {
             $request->setModuleName('default');
             $request->setControllerName('login');
             $request->setActionName('index');
             $request->setParam('sessao', 'expirada');
         }
         return;
     }
 }
開發者ID:marcelocaixeta,項目名稱:zf1,代碼行數:59,代碼來源:Timeout.php

示例3: tearDown

 /**
  * Cleanup operations after each test method is run
  *
  * @return void
  */
 public function tearDown()
 {
     ini_set('session.save_path', $this->_savePath);
     $this->assertSame(E_ALL | E_STRICT, error_reporting(E_ALL | E_STRICT), 'A test altered error_reporting to something other than E_ALL | E_STRICT');
     Zend_Session_Namespace::unlockAll();
     // unset all namespaces
     foreach (Zend_Session::getIterator() as $space) {
         try {
             Zend_Session::namespaceUnset($space);
         } catch (Zend_Session_Exception $e) {
             $this->assertRegexp('/read.only/i', $e->getMessage());
             return;
         }
     }
 }
開發者ID:jsnshrmn,項目名稱:Suma,代碼行數:20,代碼來源:SessionTest.php

示例4: _ZF_expireAll

 public function _ZF_expireAll($args)
 {
     Zend_Session_Core::setOptions(array('remember_me_seconds' => 15, 'gc_probability' => 2));
     session_id($args[0]);
     if (isset($args[1]) && !empty($args[1])) {
         $s = new Zend_Session($args[1]);
     } else {
         $s = new Zend_Session();
     }
     $result = '';
     foreach ($s->getIterator() as $key => $val) {
         $result .= "{$key} === {$val};";
     }
     $core = Zend_Session_Core::getInstance();
     $core->expireSessionCookie();
     $core->writeClose();
     echo $result;
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:18,代碼來源:SessionTestHelper.php

示例5: getIterator

 /**
  * 登録済み名前空間をすべて取得
  *
  * @static
  * @access public
  */
 public static function getIterator()
 {
     return parent::getIterator();
 }
開發者ID:noriotakei,項目名稱:suraimu,代碼行數:10,代碼來源:ComSession.php

示例6: testUnsetAllNamespace

 /**
  * test unsetAll keys in default namespace
  * expect namespace will contain no keys
  */
 public function testUnsetAllNamespace()
 {
     $s = new Zend_Session('somenamespace');
     $result = '';
     foreach ($s->getIterator() as $key => $val) {
         $result .= "{$key} === {$val};";
     }
     $this->assertTrue(empty($result), "tearDown failure, found keys in 'somenamespace' namespace: '{$result}'");
     $s->a = 'apple';
     $s->lock();
     $s->unlock();
     $s->p = 'papaya';
     $s->c = 'cherry';
     $s = new Zend_Session('somenamespace');
     $result = '';
     foreach ($s->getIterator() as $key => $val) {
         $result .= "{$key} === {$val};";
     }
     $this->assertTrue($result === 'a === apple;p === papaya;c === cherry;', "unsetAll() setup for test failed: '{$result}'");
     $s->unsetAll();
     $result = '';
     foreach ($s->getIterator() as $key => $val) {
         $result .= "{$key} === {$val};";
     }
     $this->assertTrue(empty($result), "unsetAll() did not remove keys from namespace: '{$result}'");
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:30,代碼來源:SessionTest.php


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