php - Sf2 RedirectResponse not working -
i using httpfoundation component in project without using full symfony2 framework. try make redirectresponse if credentials true , redirect user (like stated in documentation), return
statement not working.
i have:
use symfony\component\httpfoundation\redirectresponse; $logged = 1; if ($logged == 1) { $response = new redirectresponse('http://google.com/'); return $response; } else { die("not logged"); }
nothing happens when execute this. if instead, redirected google:
if ($logged == 1) { $response = new redirectresponse('http://google.com/'); echo $response; }
why work echo
not return
? don't want use echo
in class libraries.
any solutions?
try: $response->send();
instead echo $response;
.
Comments
Post a Comment