【配置】支持组件配置格式:
'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',
),