当我从应用程序点击API时,我的laravel代码返回了“ Get Method”,不允许使用此路线。

发布于 2025-02-01 21:43:34 字数 247 浏览 1 评论 0原文

当我从应用侧击中API时,我的Laravel 5.3代码返回“对于此路线支持的甲氧疾病,不允许获得方法”, 但是在应用程序方面提出了这个请求,在我的Laravel方面也提出了此请求。

**$router->put('/booking/cancel', 'BookingController@cancel');**

但这在Hostinger Server上起作用,但在ExmyB服务器中不起作用

when i hit api from app side then my laravel 5.3 code return "Get method is not allowed for this route supported methosis PUT",
but in app side this request is PUT and in my laravel side this request is also PUT.

**$router->put('/booking/cancel', 'BookingController@cancel');**

but this works on Hostinger server but not in exmyb server..

Stuck in the case please help..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南烟 2025-02-08 21:43:34

因此,对于5.3,您需要欺骗表单方法

https://lararavel.com /Docs/5.3/Routing#form-method-spoofing

<form action="/foo/bar" method="POST">
    <input type="hidden" name="_method" value="PUT">
    <input type="hidden" name="_token" value="{{ csrf_token() }}">
</form>

So for 5.3, you need to spoof the form method

https://laravel.com/docs/5.3/routing#form-method-spoofing

<form action="/foo/bar" method="POST">
    <input type="hidden" name="_method" value="PUT">
    <input type="hidden" name="_token" value="{{ csrf_token() }}">
</form>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文