use Symfony\Component\HttpFoundation\Response; $response = new Response(); $response->redirect($_SERVER['HTTP_REFERER']); $response->send();
use Symfony\Component\HttpFoundation\RedirectResponse; $response = new RedirectResponse($_SERVER['HTTP_REFERER']); $response->send();This code creates a new RedirectResponse object and redirects the user to the previous page using the `send()` method. In both examples, the URL of the previous page is obtained using the `$_SERVER['HTTP_REFERER']` variable. Overall, these examples use the Symfony HttpFoundation package library in PHP to quickly and easily redirect users back to the previous page.