关于Yii的Cwebuser中Logout方法的疑问




public function logout($destroySession=true)

{

    if($this->beforeLogout())

    {

        if($this->allowAutoLogin)

        {

            Yii::app()->getRequest()->getCookies()->remove($this->getStateKeyPrefix());//销毁$_COOKIE['$this->getStateKeyPrefix()']

            if($this->identityCookie!==null)//identityCookie这个属性找不到在哪有赋值过!这里不清楚!我以为是用户选择了记住登录状态后,在用户注销时保存一些下次能直接登录用的cookie,

            {

                $cookie=$this->createIdentityCookie($this->getStateKeyPrefix());

                $cookie->value=null;

                $cookie->expire=0;//但这里,当设置cookie过期时间为0或者忽略不设置的情况下,cookie将会在session过期后过期(即浏览器关闭后cookie过期)

                Yii::app()->getRequest()->getCookies()->add($cookie->name,$cookie);

            }

        }

        if($destroySession)

            Yii::app()->getSession()->destroy();

        else

            $this->clearStates();

        $this->afterLogout();

    }

}



看了源码,如果用户登录时选择了记住我,则会生成cookie,但是在退出时的logout,有疑问,它先把之前生成的cookie删除,下面判断CWebUser的identityCookie属性是否为空,这个在用户登录时(选择了记住我)哪里有被赋值过?,如果没有那就为空,那下次登录时用的cookie是那来的?

请指教~谢谢~