gpt4 book ai didi

php - FOSRestBundle jsonp请求强制下载

转载 作者:搜寻专家 更新时间:2023-10-31 22:03:11 25 4
gpt4 key购买 nike

我的 fos_rest 部分的配置:

fos_rest:
serializer:
serialize_null: true
view:
view_response_listener: force
force_redirects:
html: true
formats:
jsonp: true
json: true
xml: false
rss: false
templating_formats:
html: false
mime_types:
json: ['application/json', 'application/x-json', 'application/vnd.example-com.foo+json']
jsonp: ['application/jsonp']
rss: 'application/rss+xml'
jpg: 'image/jpeg'
png: 'image/png'
jsonp_handler:
callback_param: callback
body_listener: true
param_fetcher_listener: force
allowed_methods_listener: true
access_denied_listener:
json: true
format_listener:
rules:
- { path: '^/', priorities: ['jsonp','json', 'xml'], fallback_format: json, prefer_extension: true }
routing_loader:
default_format: ~
exception:
codes:
'Symfony\Component\Routing\Exception\ResourceNotFoundException': 404
'Doctrine\ORM\OptimisticLockException': HTTP_CONFLICT
messages:
'Symfony\Component\Routing\Exception\ResourceNotFoundException': true

当我尝试访问ie时

http://10.0.0.10/users.jsonp?callback=call 

我有强制下载但未显示的数据。请求的数据是正确的。如何让它显示在浏览器中?

最佳答案

将您的配置更改为:

fos_rest:
...
view:
...
jsonp_handler:
callback_param: callback
# add jsonp mime-type here
# it's `application/javascript+jsonp` by default
mime_type: application/javascript

关于php - FOSRestBundle jsonp请求强制下载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24018419/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com