我有一个Symfony 4服务,它需要模板。我可以注入其他服务,比如
use Psr\Log\LoggerInterface;
在服务构造函数中
public function __construct(LoggerInterface $logger)
{
$this->logger = $logger;
}
我应该导入哪个类?
发布于 2018-10-05 19:23:38
我找到了如何获取模板组件
use Twig\Environment;
这就是我的类现在的样子
在构造函数中
public function __construct(Environment $templating, LoggerInterface $logger)
{
$this->templating = $templating;
$this->logger = $logger;
}
https://stackoverflow.com/questions/52645408
复制相似问题