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