我让这个控制器与MailChimp一起使用: p>
class MailchimpController扩展了Controller
{
private $ MC_API_KEY;
private $ MailChimp;
公共函数__construct()
{
$ this-> CHIMP_KEY = getenv('CHIMP_KEY');
$ this - > MailChimp = new MailChimp($ this-> CHIMP_KEY);
}
公共函数索引()
{
返回$ this-> MailChimp-> get('test');
公共函数show($ test)
{
返回$ this-> MailChimp-> get(“test / $ test”);
}
}
code > pre>
如何将此构造函数重写为服务提供者? p>
div>