我有一个问题,我正在关注symfony的文档,我在安全部分。
第一位进展顺利,但当我在访问控制部分时,我卡住了。
它说:
文件“C:\ xampp \ htdocs \ zelfstudie \ framework-standard-edition \ app / config \ security.yml”在C:\ xampp \ htdocs \ zelfstudie \ framework-standard - 中不包含有效的YAML p>
我的security.yml
:
# To get started with security, check out the documentation:
# http://symfony.com/doc/current/book/security.html
security:
# http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
providers:
in_memory:
memory: ~
firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
default:
anonymous: ~
http_basic: ~
access_control:
# require ROLE_ADMIN for /admin*
- { path: ^/admin, roles: ROLE_ADMIN }
main:
anonymous: ~
# activate different ways to authenticate
# http_basic: ~
# http://symfony.com/doc/current/book/security.html#a-configuring-how-your-users-will-authenticate
# form_login: ~
# http://symfony.com/doc/current/cookbook/security/form_login_setup.html
答案 0 :(得分:0)
因为你有:
access_control:
- { ... }
main:
anonymous: ~
这是混合YAML列表和字典,这是不允许的。我猜main
是防火墙名称所以它应该是:
security:
...
access_control:
- { path: ^/admin, roles: ROLE_ADMIN }
firewalls:
main:
anonymous: ~