标签:class nbsp color shortcut ssg homepage symfony exce 用户
1、控制器里获取当前用户信息
$user = $this->getUser();
2、判断当前用户是否登录
// yay! Use this to see if the user is logged in if (!$this->get(‘security.authorization_checker‘)->isGranted(‘IS_AUTHENTICATED_FULLY‘)) { throw $this->createAccessDeniedException(); } // equivalent shortcut: // $this->denyAccessUnlessGranted(‘IS_AUTHENTICATED_FULLY‘); // boo :(. Never check for the User object to see if they‘re logged in if ($this->getUser()) { }
3、控制器里面重定向
$this->redirectToRoute(‘homepage‘);
标签:class nbsp color shortcut ssg homepage symfony exce 用户
原文地址:https://www.cnblogs.com/linxingyun/p/9313285.html