我正在处理Codeigniter电子邮件库上的消息,发送它显示错误消息:未定义属性:CI_Email :: $ print_debugger。我也在我的在线服务器上检查了这个,但没有为我工作。
这是代码:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
function __construct()
{
parent::__construct();
}
public function index()
{
$data['main_content'] = 'home';
$this->load->view("template", $data);
}
public function refinanceEmail()
{
$zip = $this->input->post("zip");
$propertyValue = $this->input->post("propertyValue");
$mortgageBalance = $this->input->post("mortgageBalance");
$creditscore = $this->input->post("creditscore");
$city = $this->input->post("city");
$state = $this->input->post("state");
$firstName = $this->input->post("firstName");
$lastName = $this->input->post("lastName");
$phone = $this->input->post("phone");
// Message
$message = "This message is related to Refinance." . "\r\n" . "\r\n";
$message .= "Zip:: " . $zip . "\r\n";
$message .= "Property Value:: " . $propertyValue . "\r\n";
$message .= "Mortgage Balance:: " . $mortgageBalance . "\r\n";
$message .= "Credit Score:: " . $creditscore . "\r\n";
$message .= "City:: " . $city . "\r\n";
$message .= "State:: " . $state . "\r\n";
$message .= "First Name:: " . $firstName. "\r\n";
$message .= "Last Name:: " . $lastName . "\r\n";
$message .= "Phone:: " . $phone . "\r\n";
$config = Array(
'protocol' => '',
'smtp_host' => 'mail.********.net',
'smtp_port' => 25,
'smtp_user' => '*****@******.net',
'smtp_pass' => '********',
'mailtype' => 'text',
'charset' => 'utf-8'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from($phone, $firstName . " " . $lastName);
$this->email->to("submit@example.net");
$this->email->subject('My Subject');
$this->email->message($message);
if($this->email->send())
{
redirect('/welcome/thankyou');
}
else
{
show_error($this->email->print_debugger);
return false;
}
}
public function thankyou()
{
$data['main_content'] = 'thankyou';
$this->load->view("template", $data);
}
}
答案 0 :(得分:0)
print_debugger是一个函数,而不是属性
show_error($this->email->print_debugger);
应该是
show_error($this->email->print_debugger());
从这个输出中你可以理解为什么send()的调用返回false