sframe/session

session 组件

dev-master 2014-12-11 13:50 UTC

This package is not auto-updated.

Last update: 2024-09-24 03:18:20 UTC


README

简单 session 组件

安装

composer require "sframe/session:dev-master"

#选项 与原始 PHP session 选项相同 查看:https://php.ac.cn/manual/en/session.configuration.php

用法

use \SFrame\Session\Session;
Session::start();
$_SESSION['test'] = 'hello';
$session_id = Session::getId();
Session::destroy();

使用 redis 存储方式

$options = array();
$redis = new \SFrame\Redis\Redis();
Session::start($options, 'redis', $redis);

使用 memcache 存储方式

$options = array();
$memcache = new \SFrame\Memcache\Memcache();
Session::start($options, 'memcache', $memcache);