我有一个基于symfony3的应用程序。我确实注册并从doccumentation登录。 这是我在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
在localhost上是 - FileLoader.php第118行中的FileLoaderLoadException: 文件“C:\ xampp \ htdocs \ game \ app / config \ security.yml”在C:\ xampp \ htdocs \ game \ app / config \ security.yml中不包含有效的YAML(从“C”导入:\ XAMPP \ htdocs中\游戏\应用/配置\ config.yml“)
你能告诉我我做错了什么吗? 另一个代码来自我的应用程序 - https://github.com/xrbartek/mirko答案 0 :(得分:3)
YAML非常注重缩进如何改变配置结构。您必须在整个文件中保持一致的空格数。
我已经看过your config了,可以看到通过YAML parser运行它有一些问题。
我已将此更正为以下有效的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