好的,所以最终它看起来不像我预期的那样“组件化”,我需要自动加载相当多的其他东西。我使用的代码(及其适用于 Code Igniter)是:
require_once APPPATH.'/third_party/Zend_loader/StandardAutoloader.php';
use Zend\Loader\StandardAutoloader;
$loader = new StandardAutoloader();
$loader->registerNamespace('Zend\Mail',APPPATH.'/third_party/Zend_mail');
$loader->registerNamespace('Zend\Stdlib',APPPATH.'/third_party/Zend_stdlib');
$loader->registerNamespace('Zend\Validator',APPPATH.'/third_party/Zend_validator');
$loader->registerNamespace('Zend\ServiceManager',APPPATH.'/third_party/Zend_service');
$loader->registerNamespace('Zend\Mime',APPPATH.'/third_party/Zend_mime');
require_once(APPPATH.'/third_party/Zend_interop/Interop/Container/ContainerInterface.php');
$loader->register();
use Zend\Mail;
use Zend\Mail\Transport\Smtp as SmtpTransport;
use Zend\Mail\Transport\SmtpOptions;