简体   繁体   中英

Symfony - get “Redirect From” route in Controller

I need to know what route user request before been redirect to login if He is an anonymous user. I can see this information from developer bar, but I would get this in controller for customize a message to the User.

这是我在Symfony 4中得到它的方式:

$redirectRoute = $request->getSession()->get("_security.main.target_path");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM