我的security.yml文件出现错误,我检查了这篇文章Invalid type for path "security.firewalls.main.form_login". Expected array, but got string,但所有建议都无济于事。有人曾经遇到过这个问题吗?
我尝试过对这篇文章的建议(Invalid type for path "security.firewalls.main.form_login". Expected array, but got string),但它们没有起作用
# https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
providers:
my_provider:
entity:
class: App\Entity\User
property: username
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
anonymous: true
form_login:
login_path: login
check_path: login
provider: my_provider
access_control:
# - { path: ^/admin, roles: ROLE_ADMIN }
# - { path: ^/profile, roles: ROLE_USER }
我想创建一个用于登录的新控制器
答案 0 :(得分:3)
该文件不起作用,因为您的security.yml
文件格式不正确。
这是文件的更正版本:
providers:
my_provider:
entity:
class: App\Entity\User
property: username
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
anonymous: true
provider: my_provider
form_login:
login_path: login
check_path: login
access_control:
# - { path: ^/admin, roles: ROLE_ADMIN }
# - { path: ^/profile, roles: ROLE_USER }