how to use slim redirect

后端 未结 9 1456
有刺的猬
有刺的猬 2020-12-14 02:45

I have a problem. I am using slim and I have route for my main page:

$app->get(\'/\', function() use ($app) { ... 

In one of my controll

9条回答
  •  臣服心动
    2020-12-14 03:20

    From Slim3 docs http://www.slimframework.com/docs/start/upgrade.html

    $app->get('/', function ($req, $res, $args) {
      return $res->withStatus(302)->withHeader('Location', 'your-new-uri');
    });
    

提交回复
热议问题