1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-24 20:06:09 +08:00
2020-04-08 16:42:36 +08:00

32 lines
704 B
PHP

<?php
namespace App\Providers;
use Phalcon\Session\Adapter\Redis as RedisSession;
class Session extends Provider
{
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,
'index' => $config->redis->index,
'lifetime' => $config->session->lifetime,
]);
$session->start();
return $session;
});
}
}