小编pro*_*jda的帖子

Symfony2 + FOS Rest Bundle - 常规路线

我正在使用带有fos-restbundle的Symfony2开发一个应用程序.我想创建一些API路由以及一些常规路由(只有一个用于AngularJS前端).这是我的fos_rest配置(以及来自sensio的一些配置行):

sensio_framework_extra: view: { annotations: false } router: { annotations: true } request: { converters: true } fos_rest: routing_loader: default_format: json include_format: true param_fetcher_listener: force body_listener: true allowed_methods_listener: true view: view_response_listener: 'force' formats: json: true xml: true format_listener: rules: - { path: '^/api', priorities: ['json', 'xml'], fallback_format: json, prefer_extension: true } access_denied_listener: json: true

如您所见,我启用了view_response_listener并禁用了注释.我找不到为索引操作定义"常规"(非REST)路由(和视图)的方法(AngularJS的必要).继续收到错误:

ERROR - Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException: "No matching accepted Response format could be determined" at C:\wamp\www\CRMProject\vendor\friendsofsymfony\rest-bundle\EventListener\FormatListener.php line 69 
Run Code Online (Sandbox Code Playgroud)

我很感激任何帮助.

symfony fosrestbundle

6
推荐指数
2
解决办法
4358
查看次数

标签 统计

fosrestbundle ×1

symfony ×1