开始使用symfony并且遇到了服务问题。运行Symfony服务时遇到问题
... \程序\ CONFIG \ services.yml
app.pdf.service:
class: AppBundle\Service\PdfService
arguments: [format, orientation]]
... \ SRC \的appbundle \服务\ PdfService.php
namespace AppBundle\Service;
class PdfService
{
private $format;
private $orientation;
public function __construct($format, $orientation)
{
$this->format = $format;
$this->orientation = $orientation;
}
}
现在我尝试使用该服务附:
$this->container->get('app.pdf.service');
我忘了什么吗? $ this-> container-> get(ist working,cause I invoked the tcpdf/Service from whiteoctober/tcpdf-bundle。我将扩展这个服务,因为我需要更多的功能。 s00n n00n
出现错误信息? – mblaettermann
'arguments:[format,orientation]]' - >多余一个括号']'?? – yceruto
thx,但只是一个复制和粘贴错误。在我的IDE中设置第二个支架。 – n00n