我试图让我的图书馆发送电子邮件 在我的控制器中,我设置为:
$this->load->library('MY_Email'); // My library has been loaded
档案MY_Email.php
class MY_Email {
public $ci;
public $config;
public $email;
public function __construct () {
$ci = &get_instance();
$ci->load->config('email');
$this->config = array(
'protocol' => $ci->config->item('email_protocol'),
'smtp_host' => $ci->config->item('email_smtp_host'),
'smtp_port' => $ci->config->item('email_smtp_port'),
'smtp_timeout' => $ci->config->item('email_smtp_timeout'),
'smtp_user' => $ci->config->item('email_smtp_user'),
'smtp_pass' => $ci->config->item('email_smtp_pass'),
'charset' => $ci->config->item('email_charset'),
'mailtype' => $ci->config->item('email_mailtype'),
'validation' => $ci->config->item('email_validation')
);
$ci->load->library('email', $this->config);
/*This line print `Undefined property: Controller::$email` and result is NULL*/
var_dump($ci->email); die;
}
}
我错了什么? 感谢您的帮助