Redirect to the url of the clicked (referred) link

浪子不回头ぞ 提交于 2019-12-07 15:09:41

So you have 2 choices:

You can either populate the referer manually or you can have it populate in your controller by causing a login redirect by specifying it in your security.yml. i recommend the security.yml way as i haven't actually tried the manual population because i don't trust myself or anyone else for that matter to always remember to populate the refer in those situations. security.yml also has the benefit of not having redirect code all over the place.

$request->getSession()->set('referer', $request->attributes->all());

or

access_control:
    - { path: ^/product/.*, roles: IS_AUTHENTICATED_REMEMBERED }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!