回复内容: ucenter与symfony通信需要在应用文件下存在一个uc.php的文件,然后ucenter进行访问,如果可以取得这个文件的url地址,已经如何在这个文件中进行symfony的登录等等
把你uc的用户和symfony里的用户对应上,下面的代码可以用来登录:
use symfony\component\security\core\authentication\token\usernamepasswordtoken,use symfony\component\security\http\event\interactiveloginevent;use symfony\component\security\http\securityevents;// ... $token = new usernamepasswordtoken($user, $user->getpassword(), 你防火墙的名字, $user->getroles());$this->get(security.context)->settoken($token);// 抛出登录事件$event = new interactiveloginevent($request, $token);$this->get(event_dispatcher)->dispatch(securityevents::interactive_login, $event);