phpDocumentor http
session
[ class tree: http ] [ index: http ] [ all elements ]

Class: WindSession

Source Location: /http/session/WindSession.php

Class WindSession

Class Overview

Implements interfaces:

会话机制,依赖Cache机制实现,应用可以根据自己的需求配置需要的存储方式实现会话存储

【配置】支持组件配置格式:

 'windSession' => array(
 'path' => 'WIND:http.session.WindSession',
 'scope' => 'singleton',
 'destroy' => 'commit',
 'constructor-args' => array(
 '0' => array(
 'ref' => 'windCache',
 ),
 ),
 ),
【使用】调用时使用:
 $session = Wind::getApp()->getComponent('WindSession');

 $session->set('name', 'test');    //等同:$_SESSION['name'] = 'test';
 echo $session->get('name');       //等同:echo $_SESSION['name'];

 $session->delete('name');         //等同: unset($_SESSION['name');
 echo $session->getCurrentName();     //等同: echo session_name();
 echo $session->getCurrentId();       //等同: echo session_id();
 $session->destroy();              //等同: session_unset();session_destroy();
【使用原生】: 如果用户不需要配置自己其他存储方式的session,则不许要修改任何调用,只要在WindSession的配置中将constructor-args配置项去掉即可。如下:
 'windSession' => array(
 'path' => 'WIND:http.session.WindSession',
 'scope' => 'singleton',
 'destroy' => 'commit',
 ),

Located in /http/session/WindSession.php [line 48]

WindModule
   |
   --WindSession
Author(s): Information Tags:
Version:  $Id: WindSession.php 3016 2011-10-20 02:23:08Z yishuo $
Copyright:  ©2003-2103 phpwind.com
License:  http://www.windframework.com

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From WindModule

WindModule::$_config
WindModule::$_proxy
WindModule::$_typeValidation

Inherited From WindModule

WindModule::getConfig()
根据配置名取得相应的配置
WindModule::getRequest()
返回当前应用的WindHttpRequest对象
WindModule::getResponse()
返回当前应用的WindHttpResponse对象
WindModule::getSystemFactory()
返回当前应用的WindFactory对象
WindModule::setConfig()
设置类配置
WindModule::setDelayAttributes()
设置延迟加载类属性相关组件配置信息
WindModule::toArray()
返回该对象的数组类型
WindModule::writeTableCloneProperty()
类对象clone白名单
WindModule::__call()
重载了魔术方法__call
WindModule::__clone()
重载魔术方法__clone
WindModule::__get()
重载了魔术方法__get
WindModule::__set()
重载了魔术方法__set

[ Top ]
Method Summary
void   __construct()   构造函数
void   commit()   写入session之后关闭session
void   delete()   删除数据
boolean   destroy()   清除会话信息
mixed   get()   获得数据
string   getCurrentId()   获得sessionId
string   getCurrentName()   获得当前session的名字
boolean   isRegistered()   检测变量是否已经被注册
void   set()   设置数据
boolean   setCurrentId()   设置当前session的Id
boolean   setCurrentName()   设置当前session的名字
void   setDataStoreHandler()   设置链接对象
void   start()   开启session

[ Top ]
Methods
Constructor __construct  [line 57]

  void __construct( [AbstractWindCache $dataStoreHandler = null], [object $sessionHandler = null]  )

构造函数

Parameters:
AbstractWindCache   $dataStoreHandler:  数据缓存对象,默认为null
object   $sessionHandler:  session操作设置类,默认为null

API Tags:
Access:  public


[ Top ]
commit  [line 166]

  void commit( )

写入session之后关闭session

同session_write_close


API Tags:
Access:  public


[ Top ]
delete  [line 96]

  void delete( string $key  )

删除数据

Parameters:
string   $key: 

API Tags:
Access:  public


Implementation of:
IWindHttpContainer::delete()
删除容器中的值

[ Top ]
destroy  [line 107]

  boolean destroy( )

清除会话信息


API Tags:
Access:  public


[ Top ]
get  [line 87]

  mixed get( string $key  )

获得数据

Parameters:
string   $key:  保存在session中的键名

API Tags:
Return:  返回保存在session中该键名对应的键值
Access:  public


Implementation of:
IWindHttpContainer::get()
获取容器中的内容值

[ Top ]
getCurrentId  [line 145]

  string getCurrentId( )

获得sessionId


API Tags:
Access:  public


[ Top ]
getCurrentName  [line 126]

  string getCurrentName( )

获得当前session的名字


API Tags:
Access:  public


[ Top ]
isRegistered  [line 117]

  boolean isRegistered( string $key  )

检测变量是否已经被注册

Parameters:
string   $key:  需要进行判断的建名

API Tags:
Return:  如果已经被注册则返回true,否则返回false
Access:  public


Implementation of:
IWindHttpContainer::isRegistered()
检测变量是否已经被注册

[ Top ]
set  [line 77]

  void set( string $key, mixed $value  )

设置数据

Parameters:
string   $key:  保存在session中的键名
mixed   $value:  保存在session中的值

API Tags:
Access:  public


Implementation of:
IWindHttpContainer::set()
向容器中设置值

[ Top ]
setCurrentId  [line 155]

  boolean setCurrentId( string $id  )

设置当前session的Id

Parameters:
string   $id:  需要设置的id名

API Tags:
Return:  设置成功返回true
Access:  public


[ Top ]
setCurrentName  [line 136]

  boolean setCurrentName( string $name  )

设置当前session的名字

Parameters:
string   $name:  session的名字

API Tags:
Return:  设置成功将返回true
Access:  public


[ Top ]
setDataStoreHandler  [line 176]

  void setDataStoreHandler( [ $dataStoreHandler = null], [object $sessionHandler = null], AbstractWindCache $handler  )

设置链接对象

Parameters:
AbstractWindCache   $handler:  session数据的缓存介质
object   $sessionHandler:  session操作接口的定义类
   $dataStoreHandler: 

API Tags:
Access:  public


[ Top ]
start  [line 66]

  void start( )

开启session


API Tags:
Access:  public


[ Top ]

Documentation generated on Fri, 30 Mar 2012 11:43:40 +0800 by phpDocumentor 1.4.4