json - Symfony FOS 休息包没有从 API url 获取我的 json 数据
问题描述
我正在尝试调用此 api:http://localhost/api/columns {"tab":"client"}
但我无法从 json 格式中得到那个值
我从浏览器收到此错误:{"code":404,"message":"No route found for \"GET \/api\/columns%20%7B%22tab%22:%22client%22%7D\""}
来自 CURL 的内容:{"code":400,"message":"Parameter \"tab\" of value \"NULL\" violated a constraint \"This value should not be null.\""}
这是我的 fos_rest.yml 文件:
fos_rest:
routing_loader: false
body_listener: true
exception:
enabled: true
param_fetcher_listener: force
view:
view_response_listener: 'force'
formats:
json: true
format_listener:
rules:
- { path: '^/api', prefer_extension: false , priorities: [json], fallback_format: json}
路线.yml
dashboard:
type: rest
resource: App\Controller\DashboardController
prefix : api
我从中得到什么:php bin/console debug:router
检查我的路线:
get_columns GET ANY ANY /api/columns.{_format}
解决方案
推荐阅读
- java - Why do you need timeout in milliseconds and Why do I have to declare 2 Classes with separate run () methods for separate blocks
- java - java.lang.IllegalArgumentException:不再解析元素
- c++ - 在给定的约束下填充一个 3x3 矩阵
- javascript - 如何使用 alpha 通道将 gltf 模型添加到 Aframe 和 AR.js?
- ruby - 在这种情况下如何提示用户他们已经进行了选举
- python - Python collections.Counter,如何避免双重查找
- javascript - 提交时的 JQuery 内容可编辑 div 和文本框
- javascript - onwheel 事件是否由触控板滚动触发
- android - 为什么设计看起来与 android studio 的模拟器中显示的不同?
- android - 我们如何为 navigateUp() 片段过渡设置动画?