我有一个基于Symfony3的应用程序。我确实从文档注册并登录。这是我在security.yml中的代码
security:
encoders:
AppBundle'Entity'User: bcrypt
providers:
our_db_provider:
entity:
class: AppBundle:User
property: username
firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
pattern: ^/
http_basic: ~
provider: our_db_provider
form_login:
login_path: login
check_path: login
在本地主机上是 - FileLoaderLoadException in FileLoader.php第 118 行:文件
"C:''xampp''htdocs''game''app/config''security.yml" 在 C:''xampp''htdocs''game''app/config''security.yml 中不包含有效的 YAML(从 "C:''xampp''htdocs''game''app/config''config.yml" 导入)。你能告诉我我做错了什么吗?另一个代码来自我的应用程序在这里 - https://github.com/xrbartek/mirko
YAML 非常注重缩进将如何更改配置的结构。必须在整个文件中保持空格数一致。
我已经查看了您的配置,可以看到通过 YAML 解析器运行它存在一些问题。
我已将其更正为下面的有效 YAML:
# To get started with security, check out the documentation:
# http://symfony.com/doc/current/book/security.html
security:
encoders:
AppBundle'Entity'User: bcrypt
# http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
providers:
our_db_provider:
entity:
class: AppBundle:User
property: username
firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
pattern: ^/
http_basic: ~
provider: our_db_provider
form_login:
login_path: login
check_path: login
# 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
# app/config/security.yml