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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -