我扩展 class 无法扩展构造函数 laravel。 php

i extend class want exten contructor laravel. php

我扩展 class 想要扩展构造函数 laravel。 php 我扩展 class 想要扩展构造函数 laravel。 我扩展 class 想要扩展构造函数 laravel。 构造函数 class children

function __construct($documentTemplate) {
        parent::__construct();
    }

构造函数class parent...我扩展class想要扩展构造函数laravel.....我扩展class想要扩展构造函数laravel..我扩展 class 想要扩展构造函数 laravel.

 public function __construct($documentTemplate)
    {
        // Temporary document filename initialization
        $this->tempDocumentFilename = tempnam(Settings::getTempDir(), 'PhpWord');
        if (false === $this->tempDocumentFilename) {
            throw new CreateTemporaryFileException(); // @codeCoverageIgnore
        }

        // Template file cloning
        if (false === copy($documentTemplate, $this->tempDocumentFilename)) {
            throw new CopyFileException($documentTemplate, $this->tempDocumentFilename); // @codeCoverageIgnore
        }

        // Temporary document content extraction
        $this->zipClass = new ZipArchive();
        $this->zipClass->open($this->tempDocumentFilename);
        $index = 1;
        while (false !== $this->zipClass->locateName($this->getHeaderName($index))) {
            $this->tempDocumentHeaders[$index] = $this->readPartWithRels($this->getHeaderName($index));
            $index++;
        }
        $index = 1;
        while (false !== $this->zipClass->locateName($this->getFooterName($index))) {
            $this->tempDocumentFooters[$index] = $this->readPartWithRels($this->getFooterName($index));
            $index++;
        }

        $this->tempDocumentMainPart = $this->readPartWithRels($this->getMainPartName());
        $this->tempDocumentSettingsPart = $this->readPartWithRels($this->getSettingsPartName());
        $this->tempDocumentContentTypes = $this->zipClass->getFromName($this->getDocumentContentTypesName());
    }

See screenshot for error message

您必须在扩展 class 中将参数传递给 parent::__construct();

这样:

function __construct($documentTemplate) {
    parent::__construct($documentTemplate);
}