亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

這個郵件發送是不是少了一個文件

老師的視頻中少了文件?

require_once?'swiftmailer-master/lib/swift_required.php';
require_once?'swiftmailer-master/lib/swift_init.php';

這兩個需要都有,官方文檔是這樣的http://swiftmailer.org/docs/including-the-files.html

,如果不這樣的話,郵件會老是發送失敗,希望出現錯誤的同學看下

正在回答

1 回答

Including?Swift?Mailer?(Autoloading)?
If?you?are?using?Composer,?Swift?Mailer?will?be?automatically?autoloaded.
If?not,?you?can?use?the?built-in?autoloader?by?requiring?theswift_required.php?file:
1
2
3
????require_once?'/path/to/swift-mailer/lib/swift_required.php';/*?rest?of?code?goes?here?*/
????
If?you?want?to?override?the?default?Swift?Mailer?configuration,?call?theinit()?method?on?the?Swift?class?and?pass?it?a?valid?PHP?callable?(a
PHP?function?name,?a?PHP?5.3?anonymous?function,?...):
?1
?2
?3
?4
?5
?6
?7
?8
?9
10
11
12
????require_once?'/path/to/swift-mailer/lib/swift_required.php';function?swiftmailer_configurator()?{
????//?configure?Swift?Mailer

????Swift_DependencyContainer::getInstance()->...
????Swift_Preferences::getInstance()->...}Swift::init('swiftmailer_configurator');/*?rest?of?code?goes?here?*/
????
The?advantage?of?using?the?init()?method?is?that?your?code?will?be
executed?only?if?you?use?Swift?Mailer?in?your?script.
While?Swift?Mailer's?autoloader?is?designed?to?play?nicely?with?other
autoloaders,?sometimes?you?may?have?a?need?to?avoid?using?Swift?Mailer's
autoloader?and?use?your?own?instead.?Include?the?swift_init.phpinstead?of?the?swift_required.php?if?you?need?to?do?this.?The?very
minimum?include?is?the?swift_init.php?file?since?Swift?Mailer?will?not
work?without?the?dependency?injection?this?file?sets?up:
1
2
3
????require_once?'/path/to/swift-mailer/lib/swift_init.php';/*?rest?of?code?goes?here?*/


0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

這個郵件發送是不是少了一個文件

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號