0
我爲API開發設置了symfony 3 apache 2.4和mysql環境...我剛開始並且index.html.twig頁面出現像這樣:如何將內容類型:應用程序/ json轉換爲響應頭中的html
我config.yml已FOSRest配置爲JSON格式而不是HTML:
# FOSRest Configuration
fos_rest:
body_listener: true
format_listener:
rules:
- { path: '^/', priorities: ['json'], fallback_format: json, prefer_extension: false }
param_fetcher_listener: true
view:
view_response_listener: 'force'
formats:
json: true
# Nelmio CORS Configuration
nelmio_cors:
defaults:
allow_credentials: false
allow_origin: ['*']
allow_headers: ['*']
allow_methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS']
max_age: 3600
hosts: []
origin_regex: false
我的問題:如何才能讓我的網頁渲染作爲HTML?
只是爲了笑着嘗試改變路徑:「^ /」到路徑:「^/API」 – Cerad