需要你帮忙解决这个问题。我在Slim 3框架中开发了我的网站。我想要处理“方法不被允许。必须是一个: POST”的消息,当我使用浏览器返回和转发按钮时得到。
I want to redirect to a different page when if the route is post and when user clicks on browser back or forward page.当post路由被调用时,是否有一种方法可以检测到它是post方法调用,并将其重定向到另一个get路由。
发布于 2018-05-11 12:34:33
您可以为特定错误添加自己的处理程序:
$container['notAllowedHandler'] = function (ServerRequestInterface $request, ResponseInterface $response, array $methods) {
// you can return a redirect response
};请参阅更多这里
https://stackoverflow.com/questions/50265319
复制相似问题