当我调用编写此代码以发送电子邮件的控制器方法时.我的网页无法加载.并且它不会显示任何错误


When i call the controller method in which i write this code to send email. My webpage does not load . and it does not show any error

当我调用编写此代码的控制器方法时

 $config = array(
        'protocol' => 'smtp',
        'smtp_host' => 'ssl://smtp.googlemail.com',
        'smtp_port' => 465,
        'smtp_user' => 'me.atiq32@gmail.com',
        'smtp_pass' => '********'
    );
    $this->load->library('email', $config);
    $this->email->from('me.atiq32@gmail.com', 'Atiq');
    $this->email->to('***@yahoo.com');
    $this->email->subject('Email Test');
    $this->email->message('Testing the email class.');
    if ($this->email->send()) {
        echo 'Email will be Sent';
    } else {
        echo $this->email->print_debugger();
    }
} '

以发送电子邮件。 我的网页无法加载(正在加载...甚至没有显示任何错误。

那些

流浪字符在最后吗? 如果是,他们可能会搞砸它。

否则 - 很难分辨,因为我们看不到所有代码。 在这种情况下,我所做的是在调用该方法之前回显出一个检查,例如

 echo " before email " ; 
 $this->sendemail() ; 
 echo " after email " ; 

这为您提供了健全性检查,以查看它在链条中的位置发生故障。 否则,如果您无法弄清楚,请发布更多代码。