그래서 내가 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
을 그래서 내 로컬 시스템에서 작업 to localhost
내가 안드로이드 에뮬레이터에서 api를 테스트하고 싶었는데 호스트가 내 로컬 IP 주소 192.168.178.63
으로 변경해야했지만 변경되지 않았고 현재 경로에 404가 표시됩니다. 나는 다음을 시도했다 : 캐시 지우기. var 파일을 제거합니다. 자산 덤프 및 설치 그리고 행운을 빌어 내가 bin/api_console debug:route
을 실행할 때 나는 어쨌든 그 행방 불명 인 프로젝트에서 도처에서 제거한 호스트 api.office.dev
을 얻고있다. 제발 하나 이상의 응용 프로그램과 하나 이상의 콘솔을 가지고 통지하십시오. 도움을 주시면 감사하겠습니다. 미리 감사드립니다.