Symfony的4应用程序中使用斯威夫特梅勒发送电子邮件。
我已经写了我的控制器逻辑并创建了一个表,用电子邮件联络所有工作生产服务器上。
然而,在开发模式从php bin/console server:run
我收到错误运行:
Service "logger" not found: even though it exists in the app's container, the container inside "App\Controller\PageController" is a smaller service locator that only knows about the "form.factory", "http_kernel", "parameter_bag", "request_stack", "router", "security.authorization_checker", "security.csrf.token_manager", "security.token_storage", "serializer", "session" and "twig" services.
Try using dependency injection instead.
我只是用束为是。为什么我不能从本地开发环境中发送电子邮件?
你里面App\Controller\PageController
在某种程度上取代了的Symfony的默认容器。此消息bascically意味着,物体不设置其在容器中的依赖关系。有关详情请看:https://symfony.com/doc/current/service_container.html
Symfony的使用容器模式,其中包含一个容器,它在整个应用程序可以访问内部许多对象。