前言
最近做Yii2自动登录功能,发现即使开启了Yii2的自动登录配置功能,浏览器关闭后,再次打开浏览器还是处于非登录状态。
网上查询资料基本没有相同情况。
查询登录源码:
protected function sendIdentityCookie($identity, $duration)
{
$cookie = new Cookie($this->identityCookie);
$cookie->value = json_encode([
$identity->getId(),
$identity->getAuthKey(),
$duration,
], JSON_U