我使用post
方法注销,并将响应重定向到主页,但为了获得主页的html,我需要使用get
方法。
我应该如何正确地从post
重定向到get
?还有没有更合适的注销方法?
我使用Slim v3框架来解决这个问题,它不允许从一个方法重定向到另一个方法。
$app->get('/', function (Request $request, Response $response) {
return $this->renderer->render($response, 'index.phtml');
});
$app->post('/logout', function (Request $request, Response $response) {
return $this->model->logout($response)->withRedirect("/", 308);
});
据我所知,通过POST
方法注销并通过GET
获取html页面是最好的做法。
https://stackoverflow.com/questions/51809518
复制相似问题