小编Aks*_*ose的帖子

PHP错误:致命错误:调用未定义的方法

我的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)

php methods undefined fatal-error

0
推荐指数
1
解决办法
5万
查看次数

标签 统计

fatal-error ×1

methods ×1

php ×1

undefined ×1