-1

I have a route and I want to implement a redirection into it. The root looks like this:

$app->get('/registration/validate', function (ServerRequestInterface $request, ResponseInterface $response, $args) {

try {
    $user = new \Riecken\PBS\controller\UserController();
    $result = $user->validateRegistration($request);
    $response = $response->withJson($result);
    $response = $response->withStatus(200);
    return $response;
}catch(Exception $e) {

    $response->getBody()->write($e->getMessage());
    return $response->withStatus($e->getCode());

}

});

I want to redirect it, just to test it, to google for example.

Boby
  • 77
  • 3
  • 10

1 Answers1

0

In slim, redirect() helper used to redirect request to another url. You can use it as:

$app->response->redirect('url-here');

For more information visit here.

Lovepreet Singh
  • 4,792
  • 1
  • 18
  • 36