Yii SimpleMessage.php语法错误,意外'';
我最近对我的站点进行了一次composer更新,现在在使用mailer恢复密码时遇到了一个奇怪的错误。 下面是调试器所说的:Yii SimpleMessage.php语法错误,意外'';,php,yii,swiftmailer,Php,Yii,Swiftmailer,我最近对我的站点进行了一次composer更新,现在在使用mailer恢复密码时遇到了一个奇怪的错误。 下面是调试器所说的: in /home/denentza/association.denentzat.fr/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMessage.php at line 496 487488489490491492493494495496497498499500501502503504505
in /home/denentza/association.denentzat.fr/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMessage.php at line 496
487488489490491492493494495496497498499500501502503504505
*
* @return int
*/
public function getPriority()
{
list($priority) = sscanf($this->getHeaderFieldModel('X-Priority'),
'%[1-5]'
);
return $priority ?? 3;
}
/**
* Ask for a delivery receipt from the recipient to be sent to $addresses.
*
* @param array $addresses
*
* @return $this
*/
2. yii\base\ErrorHandler::handleFatalError()
高亮显示的错误行是
返回$priority??3;
我不知道该怎么办。谢谢您的帮助。显然,运算符“?”是避免NULL
值(和)的语法糖。要解决这个问题,您应该升级到最新的PHP版本。或者,您可以更改代码,但不能保证此问题或类似问题不会在您正在使用的库的其他段中出现
return $priority ?? 3;
您的返回使用的是null coalesce运算符,该运算符仅适用于PHP>=7
要使用php5.6解决此问题,您应更改为:
return isset($priority) ? $priority : 3;
您正在使用哪个php版本?谢谢。我在提升时将我的php版本更改为php7,现在一切都好了。我使用php7,但在运行控制台命令时仍然会出现此错误。