我想知道是否无论如何要将此配置从 INI 移动到 bootstrap.php 中,以使其成为全局默认设置。如果是这样,我该怎么做?我用的是zend 1.11。
提前致谢。
;resources.mail.transport.type = smtp
;resources.mail.transport.host = "smtp.gmail.com"
;resources.mail.transport.auth = login
;resources.mail.transport.ssl = ssl
;resources.mail.transport.port = 465
;resources.mail.transport.username = email@example.com
;resources.mail.transport.password = pass
;resources.mail.transport.register = true ; True by default
;resources.mail.defaultFrom.email = email@example.com
;resources.mail.defaultFrom.name = "Foo"
;resources.mail.defaultReplyTo.email = email@example.com
;resources.mail.defaultReplyTo.name = "Foo"
[解决方案]
实际上它对我有用:
$config = array(
'ssl' => $transport_ssl,
'port' => $transport_port,
'auth' => $transport_auth,
'username' => $transport_username,
'password' => $transport_password,
'register' => $transport_register,
);
$transport = new \Zend_Mail_Transport_Smtp($transport_host, $config);
// var_dump($transport);exit;
\Zend_Mail::setDefaultTransport($transport);