简体   繁体   中英

PHPMailer library

I am first time to use the PHPMailer.

(A)

require_once "./PHPMailerAutoload.php";
...

(B)

require_once "./class.phpmailer.php";
...

What is the differences between them? I see some page was used A, some page was used B. Are they perform the same thing?

If you check the source code of PHPMailerAutoload.php , you'll see it sets up the autoloader via spl_autoload_register() ;

The second option lets you include the class manually

For an extended usage of a package it is recommended to use the autoloader, as you might need to instantiate other classes in that package and it would avoid the need to manually require_once every file, one-by-one.

There's nothing different between two ways using phpmailer. But from PHPMailer version 5.2.7, it's recommended that you use PHPMailerAutoload to include PHPMailer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM