TP5 Mysql版Session驱动
创建数据表
CREATE TABLE `think_session` (
`session_id` VARCHAR(255) NOT NULL,
`session_expire` INT(11) UNSIGNED NOT NULL,
`session_data` BLOB NULL,
UNIQUE INDEX `session_id` (`session_id`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB;
下载附件,解压driver到extend目录下Config配置信息:
'session' => [
'type' => 'driver\session\Mysql', // 驱动方式 支持redis memcache memcached
'auto_start' => true, // 是否自动开启 SESSION
// Session驱动设置
'session_expire' => 3600, // Session有效期 单位:秒
'session_prefix' => 'think_', // Session前缀
'table_name' => 'session', // 表名(不包含表前缀)
'database' => [
'hostname' => '127.0.0.1', // 服务器地址
'database' => 'test', // 数据库名
'username' => 'root', // 用户名
'password' => '', // 密码
'hostport' => '3306', // 端口
'prefix' => '', // 表前缀(默认为空)
'charset' => 'utf8', // 数据库编码
]
],
注意:如果session配置项中不填写databa