0
,所以我對fos_rest.yml以下配置FOSRESTBundle format_listener更改主機不工作
FOS休息捆綁
fos_rest:
param_fetcher_listener: force
body_converter:
enabled: true
view:
view_response_listener: force
formats:
json: true
templating_formats:
html: true
format_listener:
rules:
- { path: '^/api', priorities: [ json ], fallback_format: html, prefer_extension: true }
- { path: '^/',host: 'api.office.dev', priorities: [ json ], fallback_format: html, prefer_extension: true }
- { path: '^/', priorities: [ html, '*/*' ], fallback_format: ~, prefer_extension: true }
exception:
codes:
'Symfony\Component\Routing\Exception\ResourceNotFoundException': 404
'Doctrine\ORM\OptimisticLockException': HTTP_CONFLICT
messages:
'Symfony\Component\Routing\Exception\ResourceNotFoundException': true
allowed_methods_listener: true
access_denied_listener:
json: true
body_listener: true
disable_csrf_role: ROLE_USER
它在我的本地機器上工作,所以我必須在api.office.dev
hosts文件重定向其中到本地主機
當我想從android模擬器測試api時,我需要將主機更改爲我的本地ip 192.168.178.63
,但其未更改,現在我在路由上獲得404。 我嘗試了以下方法: 清除緩存。 刪除var文件。 傾銷和安裝資產。 沒有運氣,當我運行bin/api_console debug:route
我仍然得到主機api.office.dev
,我從項目中的任何地方刪除,沒有運氣,就像它卡住某處。請注意我有多個應用程序和多個控制檯。 任何幫助,將不勝感激。提前感謝。