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


PHP Zend_Session::setExpirationHops方法代碼示例

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


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

示例1: addMessage

 /**
  * addMessage() - Add a message to flash message
  *
  * @param  string $message
  * @return Zend_Controller_Action_Helper_FlashMessenger Provides a fluent interface
  */
 public function addMessage($message)
 {
     if (self::$_messageAdded === false) {
         self::$_session->setExpirationHops(1, null, true);
     }
     if (!is_array(self::$_session->{$this->_namespace})) {
         self::$_session->{$this->_namespace} = array();
     }
     self::$_session->{$this->_namespace}[] = $message;
     return $this;
 }
開發者ID:Nerutiz,項目名稱:trades,代碼行數:17,代碼來源:FlashMessenger.php

示例2: addMessage

 /**
  * addMessage() - Add a message to flash message
  *
  * @param  string $message
  * @return Zend_Controller_Action_Helper_FlashMessenger Provides a fluent interface
  */
 public function addMessage($message, $namespace = null)
 {
     if (!is_string($namespace) || $namespace == '') {
         $namespace = $this->getNamespace();
     }
     if (self::$_messageAdded === false) {
         self::$_session->setExpirationHops(1, null, true);
     }
     if (!is_array(self::$_session->{$namespace})) {
         self::$_session->{$namespace} = array();
     }
     self::$_session->{$namespace}[] = $message;
     self::$_messageAdded = true;
     return $this;
 }
開發者ID:Cryde,項目名稱:sydney-core,代碼行數:21,代碼來源:FlashMessenger.php

示例3: addVar

 /**
  * addVar() - Add a message to flash message
  *
  * @param  string $var
  * @return Zend_Controller_Action_Helper_FlashMessenger Provides a fluent interface
  */
 public function addVar($var, $name = false)
 {
     if (self::$_varAdded === false) {
         self::$_session->setExpirationHops(1, null, true);
     }
     if (!is_array(self::$_session->{$this->_namespace})) {
         self::$_session->{$this->_namespace} = array();
     }
     if ($name) {
         self::$_session->{$this->_namespace}[$name] = $var;
     } else {
         self::$_session->{$this->_namespace}[] = $var;
     }
     return $this;
 }
開發者ID:roed,項目名稱:zend-mvc-extend,代碼行數:21,代碼來源:FlashVars.php

示例4: setMessage

 /**
  * setMessage() - method set message and type
  *
  * @param string $type
  * @param string $message
  * @param mixed $value
  * @param int $len
  * @return \Extlib\Controller\Action\Helper\FlashMessage
  */
 public function setMessage($type, $message, $value = null, $len = 25)
 {
     if (!in_array(strtolower($type), self::$_allowedTypes)) {
         throw new \Zend_Controller_Action_Exception('Incorrect type of message!');
     }
     if (!\Zend_Validate::is($len, 'Int')) {
         throw new \Zend_Controller_Action_Exception("Param 'len' must be a int value!");
     }
     if (null !== $this->_translator) {
         $message = $this->_translator->translate($message);
     }
     if (null !== $value) {
         if (strlen($value) > $len) {
             $value = mb_substr($value, 0, $len, 'UTF-8') . '..';
         }
         $message = str_replace(self::VALUE_PATTERN, $value, $message);
     }
     self::$_session->setExpirationHops(1, null, true);
     self::$_session->{$this->_namespace} = array(strtolower($type) => $message);
     self::$_messageAdded = true;
     return $this;
 }
開發者ID:lciolecki,項目名稱:zf-extensions-library,代碼行數:31,代碼來源:FlashMessage.php

示例5: testSetExpireSessionVarsByHopsOnUse

 /**
  * test expiration of namespace variables by hops
  * expect expiration of specified keys in the proper number of hops
  */
 public function testSetExpireSessionVarsByHopsOnUse()
 {
     $s = new Zend_Session('expireGuava');
     $expireBeforeHop = 2;
     $s->setExpirationHops($expireBeforeHop, 'g', true);
     // only count a hop, when namespace is used
     $s->g = 'guava';
     $s->p = 'peach';
     $s->p = 'plum';
     $id = session_id();
     session_write_close();
     // release session so process below can use it
     // we are not accessing (using) the "expireGuava" namespace, so these hops should have no effect
     for ($i = 1; $i <= $expireBeforeHop + 2; $i++) {
         exec($this->script . "expireAll {$id} notused", $result);
         $result = $this->sortResult($result);
         $this->assertTrue($result === '', "iteration over named Zend_Session namespace failed (result='{$result}'; hop #{$i})");
     }
     for ($i = 1; $i <= $expireBeforeHop + 2; $i++) {
         exec($this->script . "expireAll {$id} expireGuava", $result);
         $result = $this->sortResult($result);
         if ($i > $expireBeforeHop) {
             $expect = ';p === plum';
             $this->assertTrue($result === $expect, "unexpected results iterating over named Zend_Session namespace (result='{$result}'; expected '{$expect}'; hop #{$i})");
         } else {
             $expect = ';g === guava;p === plum';
             $this->assertTrue($result === $expect, "unexpected results iterating over named Zend_Session namespace (result='{$result}'; expected '{$expect}'; hop #{$i})");
         }
     }
     session_start();
     // resume artificially suspended session
     $core = Zend_Session_Core::getInstance();
     $core->destroy();
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:38,代碼來源:SessionTest.php

示例6: setExpireSessionVarsByHops

 /**
  * test expiration of namespace variables by hops
  * expect expiration of specified keys in the proper number of hops
  */
 public function setExpireSessionVarsByHops()
 {
     $s = new Zend_Session('expireGuava');
     $expireBeforeHop = 4;
     $s->setExpirationHops($expireBeforeHop, 'g');
     $s->g = 'guava';
     $s->p = 'peach';
     $s->p = 'plum';
     $id = session_id();
     session_write_close();
     // release session so process below can use it
     for ($i = 1; $i <= $expireBeforeHop + 2; $i++) {
         exec($this->script . "expireAll {$id} expireGuava", $result);
         $result = $this->sortResult($result);
         if ($i > $expireBeforeHop) {
             $this->assertTrue($result === ';p === plum', "iteration over named Zend_Session namespace failed (result='{$result}'; hop #{$i})");
         } else {
             $this->assertTrue($result === ';g === guava;p === plum', "iteration over named Zend_Session namespace failed (result='{$result}'; hop #{$i})");
         }
     }
     session_start();
     // resume artificially suspended session
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:27,代碼來源:SessionTest.php


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