Parse error: syntax error, unexpected ‘=‘ , PhpSpreadsheet/Cell/Cell.php

在phpstudy平台部署了laravel源代码,其中集成了maatwebsite包,我在我的项目中有一些导出excel。它在localhost中工作正常,但当我将其部署到服务器时,它总是返回错误:

message: "Parse error: syntax error, unexpected '='"
exception: "Symfony\Component\Debug\Exception\FatalThrowableError"
file: "/var/www/src/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Cell.php"
line: 517

辑cell.php文件,在我的例子中路径是vendor/phpoffice/phpspreadsheet/src/phpspreadsheet/Cell/Cell.php,因为我使用composer安装和搜索这个函数:

public function setValue($value, ?IValueBinder $binder = null): self
    {
        $binder = self::getValueBinder();
        if (!$binder->bindValue($this, $value)) {
            throw new Exception('Value could not be bound to cell.');
        }
        return $this;
    }

在此行中$binder ??= self::getValueBinder();

改为:$binder = self::getValueBinder();

你可能感兴趣的:(php,开发语言)