1、修改配置文件app/config/security.yml中自己的firewall部分,添加配置:
frontend_secured_area: pattern: ^[/a-z]*/member anonymous: ~ http_basic: ~ form_login: provider: frontend_authorization_database check_path: expacta_member_check login_path: expacta_member_login default_target_path: expacta_member_dashboard success_handler: expacta_member.authorization_handle use_forward: false use_referer: true //需要设置为true remember_me: key: 'expacta-symfony2-frontend-secret' lifetime: 31536000 path: / domain: ~ logout: path: expacta_member_logout target: expacta_member_login
@H_301_5@//frontend_secured_area是你的firewall的名称 $key = '_security.frontend_secured_area.target_path'; if ($this->container->get('session')->has($key)) { $url = $this->container->get('session')->get($key); $this->container->get('session')->remove($key); }else{ $url = $this->container->get('router')->generate('member_home'); } return new RedirectResponse($url);
@H_301_5@