Symfony 2 redirect using POST

后端 未结 3 1421
陌清茗
陌清茗 2021-01-04 05:16

In Symfony 2 I have the following code in my Controller:

// prepare to render the seller info panel
$response = array(
    \'data\' => $data,
);

// rende         


        
3条回答
  •  北荒
    北荒 (楼主)
    2021-01-04 05:39

    Latest way of doing POST request redirect (as of Symfony 2.6) is simply:

    return $this->redirectToRoute('route', [
        'request' => $request
    ], 307);
    

    Code 307 preserves the request method, while redirectToRoute() is a shortcut method.

提交回复
热议问题