websoftwares/session
Composer 安装命令:
composer require websoftwares/session
包简介
PHP 5.3+ Session Class that accepts optional save handlers.
关键字:
README 文档
README
PHP 5.3+ Session Class that accepts optional save handlers.
Installing via Composer (recommended)
Install composer in your project:
curl -s http://getcomposer.org/installer | php
Create a composer.json file in your project root:
{
"require": {
"websoftwares/session": "dev-master"
}
}
Install via composer
php composer.phar install
Usage
Basic usage of the Session class.
use Websoftwares\Session; // Instantiate class $session = new Session; // Start session $session->start(); // Store in session $session["key"] = 'value'; var_dump($_SESSION); // Destroy $session->destroy();
Options
U can override the default options by instantiating a Session class and pass in an array as the second argument.
$options = array( // If enabled (default) extra meta data is added (name,created,updated) 'meta' => true, // Provide custom session name 'name' => null, 'lifetime' => 0, 'path' => '/', 'domain' => null, 'secure' => true, 'httponly' => false ); // Instantiate class $session = new Session(null,$options);
start();
Start a new session.
$session->start();
destroy();
Destory the session.
$session->destroy();
close();
Close the session.
$session->close();
active();
Find out if their is a session active.
$session->active();
id($string);
Set session id, Get current/previous session id.
$session->id($string);
regenerate();
Regenerate session id, optional bool true for session deletion.
$session->regenerate();
ArryAccess
U can access the session object as an array.
$session["key"] = "value";
Testing
In the tests folder u can find several tests.
License
DBAD Public License.
Acknowledgement
All the great session managment solutions.
统计信息
- 总下载量: 25
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: DBAD
- 更新时间: 2013-08-26