CHttpSessionIterator
| 包 | system.web |
|---|---|
| 继承 | class CHttpSessionIterator |
| 实现 | Iterator, Traversable |
| 可用自 | 1.0 |
| 源码 | framework/web/CHttpSessionIterator.php |
CHttpSessionIterator implements an iterator for CHttpSession.
It allows CHttpSession to return a new iterator for traversing the session variables.
It allows CHttpSession to return a new iterator for traversing the session variables.
公共方法
| 方法 | 描述 | 被定义在 |
|---|---|---|
| __construct() | Constructor. | CHttpSessionIterator |
| current() | Returns the current array element. | CHttpSessionIterator |
| key() | Returns the key of the current array element. | CHttpSessionIterator |
| next() | Moves the internal pointer to the next array element. | CHttpSessionIterator |
| rewind() | Rewinds internal array pointer. | CHttpSessionIterator |
| valid() | Returns whether there is an element at current position. | CHttpSessionIterator |
方法详情
__construct()
方法
|
public void __construct()
|
源码: framework/web/CHttpSessionIterator.php#35 (显示)
public function __construct()
{
$this->_keys=array_keys($_SESSION);
}
Constructor.
current()
方法
|
public mixed current()
| ||
| {return} | mixed | the current array element |
源码: framework/web/CHttpSessionIterator.php#64 (显示)
public function current()
{
return isset($_SESSION[$this->_key])?$_SESSION[$this->_key]:null;
}
Returns the current array element. This method is required by the interface Iterator.
key()
方法
|
public mixed key()
| ||
| {return} | mixed | the key of the current array element |
Returns the key of the current array element. This method is required by the interface Iterator.
next()
方法
|
public void next()
|
源码: framework/web/CHttpSessionIterator.php#73 (显示)
public function next()
{
do
{
$this->_key=next($this->_keys);
}
while(!isset($_SESSION[$this->_key]) && $this->_key!==false);
}
Moves the internal pointer to the next array element. This method is required by the interface Iterator.
rewind()
方法
|
public void rewind()
|
源码: framework/web/CHttpSessionIterator.php#44 (显示)
public function rewind()
{
$this->_key=reset($this->_keys);
}
Rewinds internal array pointer. This method is required by the interface Iterator.
valid()
方法
|
public boolean valid()
| ||
| {return} | boolean | |
源码: framework/web/CHttpSessionIterator.php#87 (显示)
public function valid()
{
return $this->_key!==false;
}
Returns whether there is an element at current position. This method is required by the interface Iterator.