如何在Symfony 2内存中用户提供程序中添加自定义密钥?
providers:
administrators:
memory:
users:
admin: { password: admin, roles: [ 'ROLE_USER' ] }
如果我修改上述内容,则添加image
属性用户将无法再登录。真是一个奇怪的问题。
providers:
administrators:
memory:
users:
admin: { password: admin, roles: [ 'ROLE_USER' ], image: "img/plh.png" }
答案 0 :(得分:4)
原因在于错误日志:
PHP Fatal error: Uncaught exception 'Symfony\Component\Config\Definition\Exception\InvalidConfigurationException' with message 'Unrecognized options "image" under "security.providers.in_memory.memory.users.manage"' in ~/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/ArrayNode.php:306
要修复它,您可以扩展SecurityBundle的配置: http://symfony.com/doc/current/cookbook/bundles/prepend_extension.html