[英]Symfony php error when configuring users and roles
我正在尝试在我的php程序中配置一组用户和角色。 我已经按照synfony网站上的教程进行操作,但是收到以下错误消息:
(1/1)InvalidTypeException路径“ security.access_control.0.path”的无效类型。 预期标量,但得到数组。 提示:使用urldecoded格式
Security.yml:
# To get started with security, check out the documentation:
# https://symfony.com/doc/current/security.html
security:
providers:
in_memory:
memory:
users:
inkoper:
password: inkoper
roles: 'ROLE_INKOPER'
access_control:
- { path '^/*', roles: [ROLE_INKOPER] }
encoders:
Symfony\Component\Security\Core\User\User: plaintext
firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
anonymous: ~
# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
http_basic: ~
# https://symfony.com/doc/current/security/form_login_setup.html
#form_login: ~
更新
多亏了Andrew Vakhniuk,我才发现了问题。 我忘记在访问控制下的路径后面加上“:”。
将访问控制更改为
- { path: '^/', roles: ROLE_INKOPER }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.