php - Laravel 不支持 DELETE & PUT 请求?
问题描述
建立我的API
结果是,如果我正在使用DELETE
或PUT
请求 Laravel throws 405 Error
(Method Not Allowed)
。如何让它发挥作用?
Laravel 错误:
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException 此路由不支持 PUT 方法。支持的方法:GET、HEAD。
解决方案
Laravel 确实支持 DELETE 和 PUT。您定义了错误的路线,它只允许 GET-Requests。
Route::put('/put', 'Controller@function');
Route::delete('/delete', 'Controller@function');
推荐阅读
- mongodb - 如何将新节点添加到 docker swarm 中的 mongodb 副本集(docker compose 3.4)
- c# - 为什么我的 Android 应用程序冻结且无法部署?
- python - 用于保存和操作大张量的高效 HDF5 / PyTables 布局
- python - pydicom:dcm_read specific_taglist 参数创建属性错误
- java - 图例标题未在图表中正确显示
- react-native - react-native - [object] 不能用作本地方法参数
- flutter - 为什么我不能在子小部件中使用我为 onTap 传递的函数?
- loops - 尝试将姓名和年龄写入文本文件
- flutter - 如何在 Flutter 中将英文数字转换为另一种语言数字(我使用的是孟加拉语)?
- python - 具有透明框架和不透明边缘的图例