如何授予IS_AUTHENTICATED_ANONYMOUSLY访问包含参数的路由?
我尝试在访问控制路径中引入参数(见下文)但得到异常:The file "/vagrant/app/config/security.yml" does not contain valid YAML.
Security.yml
access_control:
- { path: ^/api/profile/img/{id}, roles: IS_AUTHENTICATED_ANONYMOUSLY, methods: [GET] }
- { path: ^/api, roles: ROLE_API }
Profile.php
/**
* @Route("/api/profile/img/{id}", name="profile_img_get", requirements={"id": "\d+"})
* @Method("GET")
*/
public function getAction($id, Request $request)
{}