session 的redis配置和你一样的。
public function switchIdentity($identity, $duration = 0)
{
$this->setIdentity($identity);
if (!$this->enableSession) {
return;
}
/* Ensure any existing identity cookies are removed. */
if ($this->enableAutoLogin && ($this->autoRenewCookie || $identity === null)) {
$this->removeIdentityCookie();
}
$session = Yii::$app->getSession();
if (!YII_ENV_TEST) {
$session->regenerateID(true);
}
$session->remove($this->idParam);
$session->remove($this->authTimeoutParam);
if ($identity) {
var_dump($identity->getId());
exit();
执行退出重登录后,输出的还是 string(1) "2"
同时发现redis里面的内容好像类型就是 string的。

再次执行清空redis seesion所有数据。重新登录后 查看redis记录是
__flash|a:0:{}currency_current|s:3:"USD";FBRLH_state|s:32:"f9fd12780aa786c202a50eb88b997c52";__id|s:1:"2";current_session_cart_id|s:1:"7";
按理说应该是 __id|i:2; 吧? 我redis不熟悉 :(