2014-11-14 80 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>' 
));