1
PHPMailer를 확장하는 사용자 정의 클래스가 있으며 send 함수를 재정의하려고합니다. 이것은 작동하는 것으로 보입니다.하지만 parent::send()
이 활성 객체에서 작업 중이거나 무작위로 전송하는 경우 머리를 감싸는 데 문제가 있습니다. 기본적으로 parent::send()
은 우리가 어떤 특정 객체를 처리하는지 어떻게 알 수 있습니까?PHPMailer 재정의 보내기
class Mailer extends PHPMailer
{
public function __construct()
{
$this->isSMTP();
$this->Host = 'smtp.gmail.com';
$this->SMTPAuth = true;
$this->Username = '';
$this->Password = '';
$this->SMTPSecure = 'ssl';
$this->Port = 465;
}
/**
* Overrides parent send()
*
* @return boolean
*/
public function send() {
if (!parent::send()) {
// do some stuff here
return false;
} else {
return true;
}
}
}
나는과 같이 인스턴스화 : 라이언의 말처럼, 어쨌든 작동됩니다 만,
$mail = new Mailer();
// create mailer stuff here
$mail->send(); // <- How do I know this is acting on the $mail instance?
Gotchya ... 나는 방금 전성기 체크가 필요하다고 생각합니다. 감사! – kylex