1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-29 13:51:37 +08:00
2019-12-13 00:10:10 +08:00

32 lines
692 B
PHP

<?php
namespace App\Providers;
use Phalcon\Session\Adapter\Redis as RedisSession;
class Session extends AbstractProvider
{
protected $serviceName = 'session';
public function register()
{
$this->di->setShared($this->serviceName, function () {
$config = $this->getShared('config');
$session = new RedisSession([
'host' => $config->redis->host,
'port' => $config->redis->port,
'auth' => $config->redis->auth,
'lifetime' => $config->session->lifetime,
'index' => 1,
]);
$session->start();
return $session;
});
}
}