遇到PHPMailer未定義類型錯誤(嘗試使用Composer也無效)
P粉921165181
P粉921165181 2023-11-12 17:35:06

我不知道為什麼會收到此「PHPMailer 未定義類型」錯誤。首先,我嘗試直接下載zip並從github複製程式碼,同樣的問題出現,然後我下載了我不想下載的composer,但下載後仍然顯示相同的錯誤。

請問我可以對此有什麼想法嗎? (以下截圖)

作曲家 img 錯誤

沒有作曲家img時出現同樣的錯誤

目錄圖片

這是程式碼

session_start();

// Import PHPMailer classes into the global namespace 
use PHPMailerPHPMailerPHPMailer; 
use PHPMailerPHPMailerException; 
 
require 'PHPMailer/src/Exception.php'; 
require 'PHPMailer/src/PHPMailer.php'; 
require 'PHPMailer/src/SMTP.php'; 
 
$mail = new PHPMailer(true);   // error coming here
 
$mail->isSMTP();                      // Set mailer to use SMTP 
$mail->Host = 'smtp.gmail.com';       // Specify main and backup SMTP servers 
$mail->SMTPAuth = true;               // Enable SMTP authentication 
$mail->Username = '[email protected]';   // SMTP username 
$mail->Password = 'gmail_password';   // SMTP password 
$mail->SMTPSecure = 'tls';            // Enable TLS encryption, `ssl` also accepted 
$mail->Port = 587;                    // TCP port to connect to 
 
// Sender info

謝謝

P粉921165181
P粉921165181

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!