我的小功能非常简单,在发送电子邮件后,我收到以下错误消息:
Severity: error --> Exception: Call to a member function from() on null
功能
public function index(){
$this->load->helper('email');
$this->email->from("soule.farouk@aef.info");
$this->email->to('farouksoule@gmail.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
log_message('Error', $CI->email->print_debugger());
}
答案 0 :(得分:2)
您helper()
应为library()
public function index(){
$this->load->library('email');
$this->email->from("soule.farouk@aef.info");
$this->email->to('farouksoule@gmail.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
log_message('Error', $this->email->print_debugger());
}
答案 1 :(得分:1)
使用此
public function index() {
$this->load->library('email');
$this->email->from("soule.farouk@aef.info");
$this->email->to('farouksoule@gmail.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
log_message('Error', $CI->email->print_debugger());
}
而不是帮助使用库 有关详细信息,请使用此链接