Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony 2 Previous URL

Tags:

url

php

symfony

How to check in symfony2 controller previous URL, like in symfony 1.x ? Something equivalent to:

$request->getReferer();
like image 395
Pawel Avatar asked Dec 30 '11 15:12

Pawel


2 Answers

To check controller previous URL in symfony 2 :

$this->getRequest()->headers->get('referer')
like image 78
Inoryy Avatar answered Nov 11 '22 14:11

Inoryy


In new version of symfony the request object should be injected!

public function show(Request $request)
{
        $request->headers->get('referer');
        //...
}
like image 31
Vazgen Manukyan Avatar answered Nov 11 '22 14:11

Vazgen Manukyan