[英]Symfony php error when configuring users and roles
I am trying to configure a set of users and roles in my php program. 我正在尝试在我的php程序中配置一组用户和角色。 I've followed the tutorial on the synfony website but I recieve the following error:
我已经按照synfony网站上的教程进行操作,但是收到以下错误消息:
(1/1) InvalidTypeException Invalid type for path "security.access_control.0.path".
(1/1)InvalidTypeException路径“ security.access_control.0.path”的无效类型。 Expected scalar, but got array.
预期标量,但得到数组。 Hint: use the urldecoded format
提示:使用urldecoded格式
Security.yml: 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: ~
Update 更新
I found the problem thanks to Andrew Vakhniuk. 多亏了Andrew Vakhniuk,我才发现了问题。 I forgot to put a ':' after path under access control.
我忘记在访问控制下的路径后面加上“:”。
将访问控制更改为
- { path: '^/', roles: ROLE_INKOPER }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.