我的Mail类有问题.它以前工作,但现在我不确定发生了什么.这是错误:
Fatal error: Call to undefined method Mail::sendTo() in C:\...\web\modules\register.php on line 30
Run Code Online (Sandbox Code Playgroud)
我的邮件类:
class Mail
{
public static $Headers = 'From:akshay@myemail.com';
public $sendtowho;
public $subject;
public $message;
public $template;
public function sendTo($who='')
{
$this->sendtowho = $who;
}
public function with($subj='',$template)
{
$this->subject = $subj;
$this->template = $template;
}
public function addVars($variables)
{
$TemplateHandler = new Template('mail');
$this->message = $TemplateHandler->renderContent($this->template, $variables);
}
public function send()
{
mail($this->sendtowho, $this->subject, $this->message, self::$Headers);
}
}
Run Code Online (Sandbox Code Playgroud)
我的register.php
$mail = new Mail();
$mail->sendTo(User::getMailFromUsername($username));
$mail->with(' Registration …Run Code Online (Sandbox Code Playgroud)