Swift Mailer错误登录lib / classes / Swift / Transport / EsmtpTransport.php [复制]

This question already has an answer here:

I have a new installation of Swift Mailer. When sending emails it fails and in the .errorlog file I have the following:

[25-Jun-2019 09:51:32 America/Detroit] PHP Parse error: syntax error, unexpected '?' in /home/qetbcdfu/public_html/swift/lib/classes/Swift/Transport/EsmtpTransport.php on line 213

Help appreciated!

require_once 'lib/swift_required.php';
// Create the Transport
$transport = (new Swift_SmtpTransport('mail.authsmtp.com', 25))
->setUsername('hidden')
->setPassword('hidden');
// Create the Mailer using your created Transport
$mailer = new Swift_Mailer($transport);
// Create a message
$themessage .= "<p>Hi this is an email message that is a test message from Cedine's Swift AuthSMTP programming interface.  I hope you have enjoyed receiving this message.</p><p><strong>Please delete this message.</strong></p>"; 
$message = Swift_Message::newInstance('An Invitation to Join the Global CHE Network')
      ->setFrom('jim@jimnull.com')
      ->setTo(array('jsnull@outlook.com', 'jnull1955@gmail.com'))
      ->setBody($themessage, 'text/html');  
// Send the message
$result = $mailer->send($message);  
print "<p>Sent</p>";
</div>
php
dou8mwz5079
dou8mwz5079 我已经更改了我的代码,现在我收到以下error_log消息...
一年多之前 回复

1个回答



我认为你在php 5.6上运行,因为错误发生在php 7.x运算符上。</ p>

< p>正如我们在源代码中看到的 213行他们使用 ?? </ code>运算符。 这个运算符可以从php 7.x获得,如 php docs </ p>

因为php 5.6已经生命终结你应该考虑升级到更新版本的php </ p>
</ div>

展开原文

原文

I think you run on php 5.6 since the error is on a php 7.x operator.

As we can see in the source code on line 213 they use ?? operator. This operator is available from php 7.x as is mentioned in the php docs

Since php 5.6 is already end of life you should look into upgrading to a newer version of php

doupo1865
doupo1865 谢谢@Perry
一年多之前 回复
dongyun51582
dongyun51582 'email')从那里你可以做你想要对消息做的所有事情
一年多之前 回复
dtgj8529
dtgj8529 是的你是对的我在5.6并升级到7.0。 我现在收到以下错误消息:[25-Jun-2019 10:19:25 America / Detroit] PHP致命错误:未捕获错误:在/ home / qetbcdfu / public_html / swift /中调用未定义的方法Swift_Message :: newInstance() swifttest.php:43堆栈跟踪:第43行/home/qetbcdfu/public_html/swift/swifttest.php中引发#0 {main}
一年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐