2014-11-14 66 views
3

我有下面的代码部分根据Mailgun文档。我在错误日志中收到此:php mailgun错误意外)

14-Nov-2014 04:21:52 UTC] PHP Parse error: syntax error, unexpected ')' in /home/[USERNAME]/public_html/m/FileName.php on line 36

,这是我的源代码:

<?php 
error_reporting(E_ALL); 
ini_set("display_errors", 1); 
date_default_timezone_set('EST'); 
# Include the Autoloader (see "Libraries" for install instructions) 
require 'vendor/autoload.php'; 
require 'html2text.php'; 
use Mailgun\Mailgun; 
# Instantiate the client. 
$mgClient = new Mailgun('[KEY]'); 
$domain = "[DOMAIN]"; 
$html = $_POST["message"]; 
$text = convert_html_to_text($html); 
$date = date('l, F jS '); 
# Make the call to the client. 
$result = $mgClient->sendMessage($domain, array(
    'from' => '[EMAIL]', 
    'to'  => '[EMAIL]', 
    'cc'  => '[EMAIL]', 
    'subject' => 'New reminder for ' . $date, 
    'text' => 'Hey, ' . "\n" . $text . "\n" . 'More text', 
    'html' => '<html><body>Hey, ' . "\n" . $html . "\n" . 'More Text.</body></html>' 
),); 
print '<h1>Sent successfully</h1>'; 
?> 

上发生了什么任何想法?第36行是结束数组的行。

+0

检查'));'。 – alu

+0

));删除逗号 –

回答

0

尝试更换

),); 

)); 

从最终删除逗号。这里不需要逗号,因为你没有传递任何更多的参数来运行。

0

这里试试这个

$result = $mgClient->sendMessage($domain, array(
    'from' => '[EMAIL]', 
    'to'  => '[EMAIL]', 
    'cc'  => '[EMAIL]', 
    'subject' => 'New reminder for ' . $date, 
    'text' => 'Hey, ' . "\n" . $text . "\n" . 'More text', 
    'html' => '<html><body>Hey, ' . "\n" . $html . "\n" . 'More Text.</body></html>' 
));