从symfony book
http://symfony.com/doc/current/book/security.html#security-authorization我试图建立基本的http身份验证.
security.yml文件如下所示:
security: providers: in_memory: memory: ~ firewalls: dev: pattern: ^/(_(profiler|wdt|error)|css|images|js)/ security: false default: anonymous: ~ http_basic: ~ access_control: - { path: ^/login,roles: ROLE_USER }
但是只要我补充一下
access_control: - { path: ^/login,roles: ROLE_USER }
我得到一个symfony错误说:
InvalidConfigurationException in ArrayNode.PHP line 309: Unrecognized option "0" under "security.firewalls.access_control"
我究竟做错了什么?该怎么做才能修复它?
你的缩进不好
access_control密钥不能保留在防火墙节点下
您应该按如下方式修改security.yml
security: providers: in_memory: memory: ~ firewalls: dev: pattern: ^/(_(profiler|wdt|error)|css|images|js)/ security: false default: anonymous: ~ http_basic: ~ access_control: - { path: ^/login,roles: ROLE_USER }