我收到错误 Fatal error: Class 'CI_Controller' not found in ....\core\CodeIgniter.php on line 233
我在 application/core/My_Exception.php 中创建了一个名为 My_Exceptions 的类 基本上,我想在用户从我的站点收到错误时收到电子邮件。
<?php
class My_Exceptions extends CI_Exceptions{
var $CI="";
function __construct(){
parent::__construct();
$this->CI =& get_instance();
}
function show_404($page = '', $log_error = TRUE)
{
$heading = "404 Page My Not Found";
$message = "The page you requested was not found.";
// By default we log this, but allow a dev to skip it
if ($log_error)
{
log_message('error', '404 Page Not Found --> '.$page);
}
//Email to Developer
$this->CI->load->library('email');
$uri = $this->CI->uri->uri_string();
$this->CI->email->from('error-donotreply@YOURAPP.com', 'APP Error');
$this->CI->email->to('youremail@example.org');
$this->CI->email->subject('APP Error [severity: '.$severity.']');
$this->CI->email->message("Page not Found. From URL: ".$uri);
$this->CI->email->send();
echo $this->show_error($heading, $message, 'error_404', 404);
exit;
}
}
请帮忙 !!!