我已經通過編程實現了登錄功能。如何實現在symfony2中以編程方式記住我?
此代碼如下:
$token = new UsernamePasswordToken($user, $user->getPassword(), 'main', $user->getRoles());
$this->get('security.context')->setToken($token);
$event = new InteractiveLoginEvent($this->getRequest(),$token);
$this->get('event_dispatcher')->dispatch('security.interactive_login', $event);
在此之後,我該如何實施還記得我?
(我知道如何使用窗體,但我想實現以編程方式記住我。 )
請幫助...
您可能會檢查[此問題](http://stackoverflow.com/questions/549)的一般圖片。 – HamZa