在我的项目中,我正在使用一个按钮在codeigniter中向客户端发送邮件。当用户单击该按钮时,将执行以下代码:
public function confirm()
{
include_once("emailController.php");
require_once('mailer/class.smtp.php');
$pdfFile_info =$_SERVER['DOCUMENT_ROOT']."/email/resources/info/"."info.pdf";
$subject="Info";
$body="Please check the attached file(s).";
$emailClient="client@gmail.com";
$emailController =new emailController();
$sendEmail=$emailController->sendEmail($subject,$body,$emailClient,$pdfFile_info);
$this->load->view('confirm_msg');
}
此处class.smtp.php
是我用来发送邮件的库。以下给出了emailController()的前几行(省略了其余部分,因为它们在这里不相关):
class emailController extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->library(array('session', 'form_validation','email'));
$this->load->helper(array('html','form', 'url'));
$this->load->driver('cache');
}
/*rest of the codes*/
}
问题是当从confirm()调用emailController时,浏览器显示消息“无法找到指定的类:Session.php”,尽管会话已在emailController()中加载。如果我从$this->load->library(array('session', 'form_validation','email'));
省略会话,那么它也会显示相同的消息。这可能是什么问题?